feat(scan): always scan downloads + organize dirs, deduplicate child paths
ResolveScanPaths() collects downloads.dir, organize.movies_dir, organize.tv_shows_dir, and library.scan_path (if set), then removes paths that are subdirectories of a parent already in the list. This ensures the daemon and CLI scan all configured dirs without relying solely on scan_path being set.
This commit is contained in:
parent
b2ed81ee74
commit
db316726fd
3 changed files with 122 additions and 47 deletions
|
|
@ -41,11 +41,16 @@ to see available quality upgrades.`,
|
|||
}
|
||||
if len(args) == 0 {
|
||||
cfg := loadConfig()
|
||||
if cfg.Library.ScanPath != "" {
|
||||
args = append(args, cfg.Library.ScanPath)
|
||||
} else {
|
||||
return fmt.Errorf("usage: unarr scan <path>\n\nProvide a media folder to scan")
|
||||
paths := library.ResolveScanPaths(cfg.Download.Dir, cfg.Organize.MoviesDir, cfg.Organize.TVShowsDir, cfg.Library.ScanPath)
|
||||
if len(paths) == 0 {
|
||||
return fmt.Errorf("usage: unarr scan <path>\n\nNo scan paths configured. Provide a path or set up downloads.dir via 'unarr init'")
|
||||
}
|
||||
for _, p := range paths {
|
||||
if err := runScan(p, workers, ffprobe, noSync); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return runScan(args[0], workers, ffprobe, noSync)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue