diff --git a/MediaBrowser.Providers/FanartBaseProvider.cs b/MediaBrowser.Providers/FanartBaseProvider.cs index dcab79717..f0f731809 100644 --- a/MediaBrowser.Providers/FanartBaseProvider.cs +++ b/MediaBrowser.Providers/FanartBaseProvider.cs @@ -67,15 +67,6 @@ namespace MediaBrowser.Providers get { return true; } } - /// - /// Gets the priority. - /// - /// The priority. - public override MetadataProviderPriority Priority - { - get { return MetadataProviderPriority.Third; } - } - #region Result Objects protected class FanArtImageInfo diff --git a/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs index 2104e449a..dd87db5b5 100644 --- a/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs +++ b/MediaBrowser.Providers/TV/FanArtSeasonProvider.cs @@ -53,6 +53,15 @@ namespace MediaBrowser.Providers.TV return item is Season; } + /// + /// Gets the priority. + /// + /// The priority. + public override MetadataProviderPriority Priority + { + get { return MetadataProviderPriority.Third; } + } + protected override DateTime CompareDate(BaseItem item) { var season = (Season)item; diff --git a/MediaBrowser.Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Providers/TV/FanArtTVProvider.cs index bfa1379a8..94296fd36 100644 --- a/MediaBrowser.Providers/TV/FanArtTVProvider.cs +++ b/MediaBrowser.Providers/TV/FanArtTVProvider.cs @@ -49,6 +49,15 @@ namespace MediaBrowser.Providers.TV return item is Series; } + /// + /// Gets the priority. + /// + /// The priority. + public override MetadataProviderPriority Priority + { + get { return MetadataProviderPriority.Third; } + } + public override ItemUpdateType ItemUpdateType { get @@ -74,12 +83,14 @@ namespace MediaBrowser.Providers.TV !ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops && - !ConfigurationManager.Configuration.DownloadSeriesImages.Banner) + !ConfigurationManager.Configuration.DownloadSeriesImages.Banner && + !ConfigurationManager.Configuration.DownloadSeriesImages.Primary) { return false; } - if (item.HasImage(ImageType.Art) && + if (item.HasImage(ImageType.Primary) && + item.HasImage(ImageType.Art) && item.HasImage(ImageType.Logo) && item.HasImage(ImageType.Banner) && item.HasImage(ImageType.Thumb) && @@ -91,7 +102,7 @@ namespace MediaBrowser.Providers.TV return base.NeedsRefreshInternal(item, providerInfo); } - protected override DateTime CompareDate(BaseItem item) + protected override bool NeedsRefreshBasedOnCompareDate(BaseItem item, BaseProviderInfo providerInfo) { var id = item.GetProviderId(MetadataProviders.Tvdb); @@ -109,7 +120,7 @@ namespace MediaBrowser.Providers.TV if (files.Count > 0) { - return files.Max(); + return files.Max() > providerInfo.LastRefreshed; } } catch (DirectoryNotFoundException) @@ -117,8 +128,8 @@ namespace MediaBrowser.Providers.TV // Don't blow up } } - - return base.CompareDate(item); + + return false; } /// @@ -215,7 +226,21 @@ namespace MediaBrowser.Providers.TV cancellationToken.ThrowIfCancellationRequested(); var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower(); - + + if (ConfigurationManager.Configuration.DownloadSeriesImages.Primary && !item.HasImage(ImageType.Primary)) + { + var node = doc.SelectSingleNode("//fanart/series/tvposters/tvposter[@lang = \"" + language + "\"]/@url") ?? + doc.SelectSingleNode("//fanart/series/tvposters/tvposter/@url"); + var path = node != null ? node.Value : null; + if (!string.IsNullOrEmpty(path)) + { + await _providerManager.SaveImage(item, path, FanArtResourcePool, ImageType.Primary, null, cancellationToken) + .ConfigureAwait(false); + } + } + + cancellationToken.ThrowIfCancellationRequested(); + if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo)) { var node = doc.SelectSingleNode("//fanart/series/hdtvlogos/hdtvlogo[@lang = \"" + language + "\"]/@url") ??