diff --git a/cmd/root.go b/cmd/root.go index 08773176a..6363825cc 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -175,7 +175,17 @@ func pidHashChanged(ds model.DataStore) (bool, error) { if err != nil { return false, err } - return !strings.EqualFold(pidAlbum, conf.Server.PID.Album) || !strings.EqualFold(pidTrack, conf.Server.PID.Track), nil + pidArtist, err := ds.Property(context.Background()).DefaultGet(consts.PIDArtistKey, "") + if err != nil { + return false, err + } + // Empty stored value is treated as matching — fresh upgrade should not force a rescan. + if pidArtist == "" { + pidArtist = conf.Server.PID.Artist + } + return !strings.EqualFold(pidAlbum, conf.Server.PID.Album) || + !strings.EqualFold(pidTrack, conf.Server.PID.Track) || + !strings.EqualFold(pidArtist, conf.Server.PID.Artist), nil } // runInitialScan runs an initial scan of the music library if needed. diff --git a/scanner/scanner.go b/scanner/scanner.go index 871b0c696..054e404be 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -309,6 +309,11 @@ func (s *scannerImpl) runUpdateLibraries(ctx context.Context, state *scanState) log.Error(ctx, "Scanner: Error updating album PID conf", err) return fmt.Errorf("updating album PID conf: %w", err) } + err = tx.Property(ctx).Put(consts.PIDArtistKey, conf.Server.PID.Artist) + if err != nil { + log.Error(ctx, "Scanner: Error updating artist PID conf", err) + return fmt.Errorf("updating artist PID conf: %w", err) + } if state.changesDetected.Load() { log.Debug(ctx, "Scanner: Refreshing library stats", "lib", lib.Name) if err := tx.Library(ctx).RefreshStats(lib.ID); err != nil {