Make ScanInterval=0 disable the periodic scan

This commit is contained in:
Deluan 2021-05-12 14:08:38 -04:00
parent 74300adbc8
commit 751e2d6147
1 changed files with 7 additions and 3 deletions

View File

@ -124,12 +124,16 @@ func Load() {
}
func validateScanSchedule() error {
if Server.ScanInterval != 0 {
if Server.ScanInterval != -1 {
log.Warn("ScanInterval is DEPRECATED. Please use ScanSchedule. See docs at https://navidrome.org/docs/usage/configuration-options/")
if Server.ScanSchedule != "@every 1m" {
log.Error("You cannot specify both ScanInterval and ScanSchedule, ignoring ScanInterval")
} else {
Server.ScanSchedule = fmt.Sprintf("@every %s", Server.ScanInterval)
if Server.ScanInterval == 0 {
Server.ScanSchedule = ""
} else {
Server.ScanSchedule = fmt.Sprintf("@every %s", Server.ScanInterval)
}
log.Warn("Setting ScanSchedule", "schedule", Server.ScanSchedule)
}
}
@ -159,7 +163,7 @@ func init() {
viper.SetDefault("address", "0.0.0.0")
viper.SetDefault("port", 4533)
viper.SetDefault("sessiontimeout", consts.DefaultSessionTimeout)
viper.SetDefault("scaninterval", 0)
viper.SetDefault("scaninterval", -1)
viper.SetDefault("scanschedule", "@every 1m")
viper.SetDefault("baseurl", "")
viper.SetDefault("uiloginbackgroundurl", consts.DefaultUILoginBackgroundURL)