fix(scanner): add back the Scanner.GenreSeparators as a deprecated option

This allows easy upgrade of containers in PikaPods

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2025-03-13 19:25:07 -04:00
parent 5c0b6fb9b7
commit b952672877
2 changed files with 14 additions and 2 deletions

View file

@ -128,7 +128,8 @@ type scannerOptions struct {
WatcherWait time.Duration
ScanOnStartup bool
Extractor string
GroupAlbumReleases bool // Deprecated: BFR Update docs
GenreSeparators string // Deprecated: Use Tags.genre.Split instead
GroupAlbumReleases bool // Deprecated: Use PID.Album instead
}
type subsonicOptions struct {
@ -307,6 +308,7 @@ func Load(noConfigDump bool) {
log.Warn(fmt.Sprintf("Extractor '%s' is not implemented, using 'taglib'", Server.Scanner.Extractor))
Server.Scanner.Extractor = consts.DefaultScannerExtractor
}
logDeprecatedOptions("Scanner.GenreSeparators")
logDeprecatedOptions("Scanner.GroupAlbumReleases")
// Call init hooks
@ -489,9 +491,10 @@ func init() {
viper.SetDefault("scanner.enabled", true)
viper.SetDefault("scanner.schedule", "0")
viper.SetDefault("scanner.extractor", consts.DefaultScannerExtractor)
viper.SetDefault("scanner.groupalbumreleases", false)
viper.SetDefault("scanner.watcherwait", consts.DefaultWatcherWait)
viper.SetDefault("scanner.scanonstartup", true)
viper.SetDefault("scanner.genreseparators", "")
viper.SetDefault("scanner.groupalbumreleases", false)
viper.SetDefault("subsonic.appendsubtitle", true)
viper.SetDefault("subsonic.artistparticipations", false)

View file

@ -175,6 +175,15 @@ func loadTagMappings() {
log.Error("No tag mappings found in mappings.yaml, check the format")
}
// Use Scanner.GenreSeparators if specified and Tags.genre is not defined
if conf.Server.Scanner.GenreSeparators != "" && len(conf.Server.Tags["genre"].Aliases) == 0 {
genreConf := _mappings.Main[TagName("genre")]
genreConf.Split = strings.Split(conf.Server.Scanner.GenreSeparators, "")
genreConf.SplitRx = compileSplitRegex("genre", genreConf.Split)
_mappings.Main[TagName("genre")] = genreConf
log.Debug("Loading deprecated list of genre separators", "separators", genreConf.Split)
}
// Overwrite the default mappings with the ones from the config
for tag, cfg := range conf.Server.Tags {
if len(cfg.Aliases) == 0 {