fixes #590 - Support new fanart tv posters

This commit is contained in:
Luke Pulverenti 2013-10-16 10:22:13 -04:00
parent 1aa71931dd
commit 722c4289a2
3 changed files with 41 additions and 16 deletions

View File

@ -67,15 +67,6 @@ namespace MediaBrowser.Providers
get { return true; } get { return true; }
} }
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.Third; }
}
#region Result Objects #region Result Objects
protected class FanArtImageInfo protected class FanArtImageInfo

View File

@ -53,6 +53,15 @@ namespace MediaBrowser.Providers.TV
return item is Season; return item is Season;
} }
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.Third; }
}
protected override DateTime CompareDate(BaseItem item) protected override DateTime CompareDate(BaseItem item)
{ {
var season = (Season)item; var season = (Season)item;

View File

@ -49,6 +49,15 @@ namespace MediaBrowser.Providers.TV
return item is Series; return item is Series;
} }
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.Third; }
}
public override ItemUpdateType ItemUpdateType public override ItemUpdateType ItemUpdateType
{ {
get get
@ -74,12 +83,14 @@ namespace MediaBrowser.Providers.TV
!ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !ConfigurationManager.Configuration.DownloadSeriesImages.Logo &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !ConfigurationManager.Configuration.DownloadSeriesImages.Thumb &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops && !ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Banner) !ConfigurationManager.Configuration.DownloadSeriesImages.Banner &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Primary)
{ {
return false; return false;
} }
if (item.HasImage(ImageType.Art) && if (item.HasImage(ImageType.Primary) &&
item.HasImage(ImageType.Art) &&
item.HasImage(ImageType.Logo) && item.HasImage(ImageType.Logo) &&
item.HasImage(ImageType.Banner) && item.HasImage(ImageType.Banner) &&
item.HasImage(ImageType.Thumb) && item.HasImage(ImageType.Thumb) &&
@ -91,7 +102,7 @@ namespace MediaBrowser.Providers.TV
return base.NeedsRefreshInternal(item, providerInfo); 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); var id = item.GetProviderId(MetadataProviders.Tvdb);
@ -109,7 +120,7 @@ namespace MediaBrowser.Providers.TV
if (files.Count > 0) if (files.Count > 0)
{ {
return files.Max(); return files.Max() > providerInfo.LastRefreshed;
} }
} }
catch (DirectoryNotFoundException) catch (DirectoryNotFoundException)
@ -118,7 +129,7 @@ namespace MediaBrowser.Providers.TV
} }
} }
return base.CompareDate(item); return false;
} }
/// <summary> /// <summary>
@ -216,6 +227,20 @@ namespace MediaBrowser.Providers.TV
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower(); 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)) if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
{ {
var node = doc.SelectSingleNode("//fanart/series/hdtvlogos/hdtvlogo[@lang = \"" + language + "\"]/@url") ?? var node = doc.SelectSingleNode("//fanart/series/hdtvlogos/hdtvlogo[@lang = \"" + language + "\"]/@url") ??