Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //DefaultTVTemplate defines the default TV path format DefaultTVTemplate = `{{ .Name }} S{{ printf "%02d" .Season }}E{{ printf "%02d" .Episode }}` + `{{ if ne .ExtraEpisode -1 }}-{{ printf "%02d" .ExtraEpisode }}{{end}}.{{ .Ext }}` //DefaultMovieTemplate defines the default movie path format DefaultMovieTemplate = "{{ .Name }} ({{ .Year }}).{{ .Ext }}" )
Functions ¶
func FileSystemSort ¶
FileSystemSort performs a media sort against the file system using the provided configuration
Types ¶
type Config ¶
type Config struct { Targets []string `opts:"mode=arg,min=1"` TVDir string `opts:"help=tv series base directory (defaults to current directory)"` MovieDir string `opts:"help=movie base directory (defaults to current directory)"` PathConfig `mode:"embedded"` Extensions string `opts:"help=types of files that should be sorted"` Concurrency int `opts:"help=search concurrency [warning] setting this too high can cause rate-limiting errors"` FileLimit int `opts:"help=maximum number of files to search"` NumDirs int `opts:"help=number of directories to include in search (default 0 where -1 means all dirs)"` AccuracyThreshold int `opts:"help=filename match accuracy threshold" default:"is 95, perfect match is 100"` MinFileSize sizestr.Bytes `opts:"help=minimum file size"` Recursive bool `opts:"help=also search through subdirectories"` DryRun bool `opts:"help=perform sort but don't actually move any files"` SkipHidden bool `opts:"help=skip dot files"` SkipSubs bool `opts:"help=skip subtitles (srt files)"` Action Action `opts:"help=filesystem action used to sort files (copy|link|move)"` HardLink bool `opts:"help=use hardlinks instead of symlinks (forces --action link)"` Overwrite bool `opts:"help=overwrites duplicates"` OverwriteIfLarger bool `opts:"help=overwrites duplicates if the new file is larger"` Watch bool `opts:"help=watch the specified directories for changes and re-sort on change"` WatchDelay time.Duration `opts:"help=delay before next sort after a change"` Verbose bool `opts:"help=verbose logs"` }
Config is a sorter configuration
type PathConfig ¶
type PathConfig struct { TVTemplate string `help:"tv series path template"` MovieTemplate string `help:"movie path template"` }
PathConfig customises the path templates
type Result ¶
type Result struct { Query string Name, Path string Ext string MType string Season, Episode, ExtraEpisode int EpisodeDate string //weekly series Year string Accuracy int }
Result holds both the results from parsing path, and the from performing the search
func Sort ¶
Sort the given path, creates a search query, performing the search and returning a Result
func SortDepthThreshold ¶
SortDepthThreshold sorts the given path, includes <depth> parent directories, creates a search query, performing the search with the given threshold and returning a Result
func SortThreshold ¶
SortThreshold sorts the given path, creates a search query, performing the search with the given threshold and returning a Result
func (*Result) PrettyPath ¶
func (result *Result) PrettyPath(config PathConfig) (string, error)
PrettyPath converts the provided "messy" path into a "pretty" cleanly formatted path using the media result