feat(scanner): add option to use fsnotify based scan watcher (#232)
* First cut at fsnotify support. Tested on Linux. * Fixed bug in logging. * Fixed lint issues. * Added new scan watcher option to README.md * Inverted conditional and dedented following code as per PR discussion. * Changed command line switch and error return on ExecuteWatch() as per GH comments. * Scan watcher: Removed scan at first start. Modified watcher to set a 10 second timer and then process in bulk. Co-authored-by: Brian Doherty <brian@hplaptop.dohertyfamily.me>
This commit is contained in:
@@ -36,6 +36,7 @@ func main() {
|
||||
confCachePath := set.String("cache-path", "", "path to cache")
|
||||
confDBPath := set.String("db-path", "gonic.db", "path to database (optional)")
|
||||
confScanInterval := set.Int("scan-interval", 0, "interval (in minutes) to automatically scan music (optional)")
|
||||
confScanWatcher := set.Bool("scan-watcher-enabled", false, "whether to watch file system for new music and rescan (optional)")
|
||||
confJukeboxEnabled := set.Bool("jukebox-enabled", false, "whether the subsonic jukebox api should be enabled (optional)")
|
||||
confProxyPrefix := set.String("proxy-prefix", "", "url path prefix to use if behind proxy. eg '/gonic' (optional)")
|
||||
confGenreSplit := set.String("genre-split", "\n", "character or string to split genre tag data on (optional)")
|
||||
@@ -134,6 +135,9 @@ func main() {
|
||||
tickerDur := time.Duration(*confScanInterval) * time.Minute
|
||||
g.Add(server.StartScanTicker(tickerDur))
|
||||
}
|
||||
if *confScanWatcher {
|
||||
g.Add(server.StartScanWatcher())
|
||||
}
|
||||
if *confJukeboxEnabled {
|
||||
g.Add(server.StartJukebox())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user