mirror of
https://github.com/navidrome/navidrome.git
synced 2026-07-02 07:12:36 +00:00
feat(scanner): trigger rescan when PID.Artist changes
This commit is contained in:
parent
12980e8d88
commit
46cb9f8d58
12
cmd/root.go
12
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.
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user