Documentation
¶
Index ¶
- Constants
- Variables
- func FindPath(ctx context.Context, path string) (string, error)
- func GetFiles(ctx context.Context, cfg *config.Instance, platform platforms.Platform, ...) ([]string, error)
- func NewNamesIndex(ctx context.Context, platform platforms.Platform, cfg *config.Instance, ...) (indexedFiles int, err error)
- func SeedCanonicalTags(ctx context.Context, db database.MediaDBI) error
- func StageMediaPath(params *StageMediaPathParams) error
- type IndexStatus
- type MediaPathFragments
- type PathFragmentParams
- type PathResult
- type StageMediaPathParams
Constants ¶
const ( PhaseDiscovering = "discovering" PhaseInitializing = "initializing" PhaseCreatingIndexes = "creating_indexes" PhaseBuildingCaches = "building_caches" )
Variables ¶
var ErrFsTimeout = errors.New("filesystem operation timed out")
ErrFsTimeout is returned when a filesystem operation exceeds the timeout.
Functions ¶
func FindPath ¶
FindPath case-insensitively finds a file/folder at a path and returns the actual filesystem case. On case-insensitive filesystems (Windows, macOS), this ensures we get the real case from the filesystem rather than preserving the input case, which prevents case-mismatch issues during string comparisons.
This function recursively normalizes the entire path from root to leaf to ensure all components match the actual filesystem case.
Special handling:
- Linux: Prefers exact match before case-insensitive match (handles File.txt vs file.txt)
- Windows: Handles 8.3 short names (PROGRA~1) via fallback to os.Stat
- All platforms: Works with symlinks, UNC paths, network drives
func GetFiles ¶
func GetFiles( ctx context.Context, cfg *config.Instance, platform platforms.Platform, systemID string, path string, pauser *syncutil.Pauser, ) ([]string, error)
GetFiles searches for all valid games in a given path and returns a list of files. Uses fastwalk for parallel directory traversal with built-in symlink cycle detection. Deep searches .zip files when ZipsAsDirs is enabled.
func NewNamesIndex ¶
func SeedCanonicalTags ¶ added in v2.7.0
SeedCanonicalTags seeds the database with canonical GameDataBase-style hierarchical tag types and values (e.g. "genre:sports:wrestling", "players:2:vs"). Definitions live in the tags package. Runs set-based inside its own transaction; already-present rows are left untouched.
func StageMediaPath ¶ added in v2.16.0
func StageMediaPath(params *StageMediaPathParams) error
StageMediaPath parses one scanned file into its media fragments and appends them to the scanner staging tables. Tags, missing state, and most existence checks run set-based in ReconcileStagedSystem once the system's files are staged, so scanner memory does not grow with library or database size.
Types ¶
type IndexStatus ¶
type MediaPathFragments ¶
type MediaPathFragments struct {
Path string
FileName string
Title string
DisplayTitle string
Slug string
SlugTokens []string
Ext string
Tags []string
}
func GetPathFragments ¶
func GetPathFragments(params *PathFragmentParams) MediaPathFragments
type PathFragmentParams ¶ added in v2.7.0
type PathFragmentParams struct {
Config *config.Instance
Path string
SystemID string
MediaType slugs.MediaType
ProvidedName string
PrefixPolicy browseprefix.Policy
NoExt bool
StripLeadingNumbers bool
}
PathFragmentParams contains parameters for GetPathFragments.
type PathResult ¶
type PathResult struct {
Path string
System systemdefs.System
}
func GetSystemPaths ¶
func GetSystemPaths( ctx context.Context, cfg *config.Instance, platform platforms.Platform, rootFolders []string, systems []systemdefs.System, ) []PathResult
type StageMediaPathParams ¶ added in v2.16.0
type StageMediaPathParams struct {
Config *config.Instance
DB database.MediaDBI
Path string
SystemID string
MediaType slugs.MediaType
ProvidedName string
PrefixPolicy browseprefix.Policy
NoExt bool
}
StageMediaPathParams contains parameters for StageMediaPath.