diff --git a/MediaBrowser.Providers/Music/AlbumDynamicInfoProvider.cs b/MediaBrowser.Providers/Music/AlbumDynamicInfoProvider.cs index 085ff9b54a..5c14a2f56c 100644 --- a/MediaBrowser.Providers/Music/AlbumDynamicInfoProvider.cs +++ b/MediaBrowser.Providers/Music/AlbumDynamicInfoProvider.cs @@ -69,6 +69,24 @@ namespace MediaBrowser.Providers.Music .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); + var date = songs.Select(i => i.PremiereDate) + .FirstOrDefault(i => i.HasValue); + + if (date.HasValue) + { + album.PremiereDate = date.Value; + album.ProductionYear = date.Value.Year; + } + else + { + var year = songs.Select(i => i.ProductionYear ?? 1800).FirstOrDefault(i => i != 1800); + + if (year != 1800) + { + album.ProductionYear = year; + } + } + // Don't save to the db return FalseTaskResult; } diff --git a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs index d74b9b0387..9606279f7d 100644 --- a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs +++ b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs @@ -107,23 +107,6 @@ namespace MediaBrowser.Providers.Music } } - var date = songs.Select(i => i.PremiereDate).FirstOrDefault(i => i.HasValue); - - if (date != null) - { - album.PremiereDate = date.Value; - album.ProductionYear = date.Value.Year; - } - else - { - var year = songs.Select(i => i.ProductionYear ?? 1800).FirstOrDefault(i => i != 1800); - - if (year != 1800) - { - album.ProductionYear = year; - } - } - if (!item.LockedFields.Contains(MetadataFields.Studios)) { album.Studios = songs.SelectMany(i => i.Studios) diff --git a/MediaBrowser.Providers/Music/LastfmHelper.cs b/MediaBrowser.Providers/Music/LastfmHelper.cs index 9d24875b2c..800fdc4383 100644 --- a/MediaBrowser.Providers/Music/LastfmHelper.cs +++ b/MediaBrowser.Providers/Music/LastfmHelper.cs @@ -103,15 +103,19 @@ namespace MediaBrowser.Providers.Music item.Overview = overview; } - DateTime release; - - if (DateTime.TryParse(data.releasedate, out release)) + // Only grab the date here if the album doesn't already have one, since id3 tags are preferred + if (!item.PremiereDate.HasValue) { - // Lastfm sends back null as sometimes 1901, other times 0 - if (release.Year > 1901) + DateTime release; + + if (DateTime.TryParse(data.releasedate, out release)) { - item.PremiereDate = release; - item.ProductionYear = release.Year; + // Lastfm sends back null as sometimes 1901, other times 0 + if (release.Year > 1901) + { + item.PremiereDate = release; + item.ProductionYear = release.Year; + } } }