diff --git a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs index c424c13e5..299ae2d06 100644 --- a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs @@ -107,34 +107,27 @@ namespace MediaBrowser.Providers.Music return false; } - var comparisonData = Guid.Empty; + return base.NeedsRefreshInternal(item, providerInfo); + } + protected override DateTime CompareDate(BaseItem item) + { var artistMusicBrainzId = item.Parent.GetProviderId(MetadataProviders.Musicbrainz); - + if (!string.IsNullOrEmpty(artistMusicBrainzId)) { var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId); artistXmlPath = Path.Combine(artistXmlPath, "fanart.xml"); - comparisonData = GetComparisonData(new FileInfo(artistXmlPath)); - } + var file = new FileInfo(artistXmlPath); + + if (file.Exists) + { + return file.LastWriteTimeUtc; + } + } - // Refresh anytime the parent mbz id changes - if (providerInfo.Data != comparisonData) - { - return true; - } - - return base.NeedsRefreshInternal(item, providerInfo); - } - - /// - /// Gets the comparison data. - /// - /// Guid. - private Guid GetComparisonData(FileInfo artistXmlFileInfo) - { - return artistXmlFileInfo.Exists ? (artistXmlFileInfo.FullName + artistXmlFileInfo.LastWriteTimeUtc.Ticks).GetMD5() : Guid.Empty; + return base.CompareDate(item); } /// @@ -158,8 +151,6 @@ namespace MediaBrowser.Providers.Music item.ProviderData[Id] = data; } - var comparisonData = Guid.Empty; - if (!string.IsNullOrEmpty(artistMusicBrainzId)) { var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId); @@ -167,8 +158,6 @@ namespace MediaBrowser.Providers.Music var artistXmlFileInfo = new FileInfo(artistXmlPath); - comparisonData = GetComparisonData(artistXmlFileInfo); - if (artistXmlFileInfo.Exists) { var album = (MusicAlbum)item; @@ -226,7 +215,6 @@ namespace MediaBrowser.Providers.Music } - data.Data = comparisonData; SetLastRefreshed(item, DateTime.UtcNow); return true; diff --git a/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs index e2ac53414..ccdfc2a81 100644 --- a/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs @@ -45,28 +45,7 @@ namespace MediaBrowser.Providers.TV return item is Season; } - /// - /// Needses the refresh internal. - /// - /// The item. - /// The provider info. - /// true if XXXX, false otherwise - protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) - { - if (GetComparisonData(item) != providerInfo.Data) - { - return true; - } - - return base.NeedsRefreshInternal(item, providerInfo); - } - - /// - /// Gets the comparison data. - /// - /// The item. - /// Guid. - private Guid GetComparisonData(BaseItem item) + protected override DateTime CompareDate(BaseItem item) { var season = (Season)item; var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null; @@ -78,24 +57,13 @@ namespace MediaBrowser.Providers.TV var imagesFileInfo = new FileInfo(imagesXmlPath); - return GetComparisonData(imagesFileInfo); + if (imagesFileInfo.Exists) + { + return imagesFileInfo.LastWriteTimeUtc; + } } - return Guid.Empty; - } - - /// - /// Gets the comparison data. - /// - /// The images file info. - /// Guid. - private Guid GetComparisonData(FileInfo imagesFileInfo) - { - var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue; - - var key = date.Ticks + imagesFileInfo.FullName; - - return key.GetMD5(); + return base.CompareDate(item); } /// @@ -138,8 +106,6 @@ namespace MediaBrowser.Providers.TV item.ProviderData[Id] = data; } - data.Data = GetComparisonData(imagesFileInfo); - SetLastRefreshed(item, DateTime.UtcNow); return true; } diff --git a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs index 66da6d101..6e8531b07 100644 --- a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs @@ -117,20 +117,10 @@ namespace MediaBrowser.Providers.TV return false; } - if (GetComparisonData(item) != providerInfo.Data) - { - return true; - } - return base.NeedsRefreshInternal(item, providerInfo); } - /// - /// Gets the comparison data. - /// - /// The item. - /// Guid. - private Guid GetComparisonData(BaseItem item) + protected override DateTime CompareDate(BaseItem item) { var episode = (Episode)item; @@ -143,24 +133,13 @@ namespace MediaBrowser.Providers.TV var seriesXmlFileInfo = new FileInfo(seriesXmlPath); - return GetComparisonData(seriesXmlFileInfo); + if (seriesXmlFileInfo.Exists) + { + return seriesXmlFileInfo.LastWriteTimeUtc; + } } - - return Guid.Empty; - } - - /// - /// Gets the comparison data. - /// - /// The series XML file info. - /// Guid. - private Guid GetComparisonData(FileInfo seriesXmlFileInfo) - { - var date = seriesXmlFileInfo.Exists ? seriesXmlFileInfo.LastWriteTimeUtc : DateTime.MinValue; - - var key = date.Ticks + seriesXmlFileInfo.FullName; - - return key.GetMD5(); + + return base.CompareDate(item); } /// @@ -207,8 +186,6 @@ namespace MediaBrowser.Providers.TV item.ProviderData[Id] = data; } - data.Data = GetComparisonData(seriesXmlFileInfo); - SetLastRefreshed(item, DateTime.UtcNow, status); return true; } diff --git a/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs index 98cc28721..bf57d3c8c 100644 --- a/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs @@ -104,28 +104,7 @@ namespace MediaBrowser.Providers.TV } } - /// - /// Needses the refresh internal. - /// - /// The item. - /// The provider info. - /// true if XXXX, false otherwise - protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) - { - if (GetComparisonData(item) != providerInfo.Data) - { - return true; - } - - return base.NeedsRefreshInternal(item, providerInfo); - } - - /// - /// Gets the comparison data. - /// - /// The item. - /// Guid. - private Guid GetComparisonData(BaseItem item) + protected override DateTime CompareDate(BaseItem item) { var seriesId = item.GetProviderId(MetadataProviders.Tvdb); @@ -136,24 +115,13 @@ namespace MediaBrowser.Providers.TV var imagesFileInfo = new FileInfo(imagesXmlPath); - return GetComparisonData(imagesFileInfo); + if (imagesFileInfo.Exists) + { + return imagesFileInfo.LastWriteTimeUtc; + } } - - return Guid.Empty; - } - - /// - /// Gets the comparison data. - /// - /// The images file info. - /// Guid. - private Guid GetComparisonData(FileInfo imagesFileInfo) - { - var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue; - - var key = date.Ticks + imagesFileInfo.FullName; - - return key.GetMD5(); + + return base.CompareDate(item); } /// @@ -195,8 +163,6 @@ namespace MediaBrowser.Providers.TV item.ProviderData[Id] = data; } - data.Data = GetComparisonData(imagesFileInfo); - SetLastRefreshed(item, DateTime.UtcNow); return true; }