diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 8e5fe8c0e..ab9525636 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -163,7 +163,8 @@ namespace MediaBrowser.Providers.Manager } } - updateType = updateType | (await BeforeSave(itemOfType, item.DateLastSaved == default(DateTime) || refreshOptions.ReplaceAllMetadata, updateType).ConfigureAwait(false)); + var beforeSaveResult = await BeforeSave(itemOfType, item.DateLastSaved == default(DateTime) || refreshOptions.ReplaceAllMetadata || refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh, updateType).ConfigureAwait(false); + updateType = updateType | beforeSaveResult; // Save if changes were made, or it's never been saved before if (refreshOptions.ForceSave || updateType > ItemUpdateType.None || item.DateLastSaved == default(DateTime) || refreshOptions.ReplaceAllMetadata) diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index 11348361a..90248e418 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -104,14 +104,15 @@ namespace MediaBrowser.Providers.Music { var updateType = ItemUpdateType.None; - var albumArtists = songs + var artists = songs .SelectMany(i => i.AlbumArtists) .Distinct(StringComparer.OrdinalIgnoreCase) + .OrderBy(i => i) .ToList(); - if (!item.AlbumArtists.SequenceEqual(albumArtists, StringComparer.OrdinalIgnoreCase)) + if (!item.AlbumArtists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase)) { - item.AlbumArtists = albumArtists; + item.AlbumArtists = artists; updateType = updateType | ItemUpdateType.MetadataEdit; } @@ -122,14 +123,15 @@ namespace MediaBrowser.Providers.Music { var updateType = ItemUpdateType.None; - var currentList = item.Artists.ToList(); - - item.Artists = songs.SelectMany(i => i.Artists) + var artists = songs + .SelectMany(i => i.Artists) .Distinct(StringComparer.OrdinalIgnoreCase) + .OrderBy(i => i) .ToList(); - if (currentList.Count != item.Artists.Count || !currentList.OrderBy(i => i).SequenceEqual(item.Artists.OrderBy(i => i), StringComparer.OrdinalIgnoreCase)) + if (!item.Artists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase)) { + item.Artists = artists; updateType = updateType | ItemUpdateType.MetadataEdit; }