update to fanart api changes

This commit is contained in:
Luke Pulverenti 2013-10-13 15:22:55 -04:00
parent 22b8c830fd
commit 9bfe68c535
5 changed files with 21 additions and 30 deletions

View File

@ -136,12 +136,6 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
public ImageDownloadOptions DownloadMusicAlbumImages { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [download TV season backdrops].
/// </summary>
/// <value><c>true</c> if [download TV season banner]; otherwise, <c>false</c>.</value>
public bool DownloadHDFanArt { get; set; }
/// <summary>
/// Characters to be replaced with a ' ' in strings to create a sort name
/// </summary>
@ -273,7 +267,6 @@ namespace MediaBrowser.Model.Configuration
DownloadSeasonImages = new ImageDownloadOptions();
DownloadMusicArtistImages = new ImageDownloadOptions();
DownloadMusicAlbumImages = new ImageDownloadOptions();
DownloadHDFanArt = true;
MaxBackdrops = 3;
SortReplaceCharacters = new[] { ".", "+", "%" };

View File

@ -68,7 +68,7 @@ namespace MediaBrowser.Providers.Movies
return ItemUpdateType.ImageUpdate;
}
}
/// <summary>
/// Gets a value indicating whether [refresh on version change].
/// </summary>
@ -159,7 +159,7 @@ namespace MediaBrowser.Providers.Movies
return base.NeedsRefreshInternal(item, providerInfo);
}
protected override DateTime CompareDate(BaseItem item)
protected override bool NeedsRefreshBasedOnCompareDate(BaseItem item, BaseProviderInfo providerInfo)
{
var id = item.GetProviderId(MetadataProviders.Tmdb);
@ -177,16 +177,16 @@ namespace MediaBrowser.Providers.Movies
if (files.Count > 0)
{
return files.Max();
return files.Max() > providerInfo.LastRefreshed;
}
}
catch (DirectoryNotFoundException)
{
// Don't blow up
return true;
}
}
return base.CompareDate(item);
return base.NeedsRefreshBasedOnCompareDate(item, providerInfo);
}
/// <summary>
@ -291,23 +291,23 @@ namespace MediaBrowser.Providers.Movies
{
var doc = new XmlDocument();
doc.Load(xmlFilePath);
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
cancellationToken.ThrowIfCancellationRequested();
string path;
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo))
{
var node =
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/hdmovielogos/hdmovielogo[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/movielogos/movielogo[@lang = \"" + language + "\"]/@url");
if (node == null && language != "en")
{
//maybe just couldn't find language - try just first one
node = doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo/@url");
node = doc.SelectSingleNode("//fanart/movie/hdmovielogos/hdmovielogo/@url") ??
doc.SelectSingleNode("//fanart/movie/movielogos/movielogo/@url");
}
path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))
@ -320,8 +320,8 @@ namespace MediaBrowser.Providers.Movies
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art))
{
var node =
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart/@url") ??
doc.SelectSingleNode("//fanart/movie/hdmoviecleararts/hdmovieclearart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/hdmoviecleararts/hdmovieclearart/@url") ??
doc.SelectSingleNode("//fanart/movie/moviearts/movieart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/moviearts/movieart/@url");
path = node != null ? node.Value : null;

View File

@ -197,7 +197,7 @@ namespace MediaBrowser.Providers.Movies
return false;
// Boxsets require two passes because we need the children to be refreshed
if (item is BoxSet && string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.TmdbCollection)))
if (item is BoxSet && string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tmdb)))
{
return true;
}

View File

@ -306,11 +306,11 @@ namespace MediaBrowser.Providers.Music
cancellationToken.ThrowIfCancellationRequested();
string path;
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo))
{
var node =
doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ??
doc.SelectSingleNode("//fanart/music/musiclogos/hdmusiclogo/@url") ??
doc.SelectSingleNode("//fanart/music/musiclogos/musiclogo/@url");
path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))
@ -371,7 +371,7 @@ namespace MediaBrowser.Providers.Music
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art))
{
var node =
doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ??
doc.SelectSingleNode("//fanart/music/hdmusicarts/hdmusicart/@url") ??
doc.SelectSingleNode("//fanart/music/musicarts/musicart/@url");
path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))
@ -395,7 +395,7 @@ namespace MediaBrowser.Providers.Music
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner))
{
var node = doc.SelectSingleNode("//fanart/music/musicbanners/" + hd + "musicbanner/@url") ??
var node = doc.SelectSingleNode("//fanart/music/hdmusicbanners/hdmusicbanner/@url") ??
doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url");
path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))

View File

@ -216,12 +216,11 @@ namespace MediaBrowser.Providers.TV
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
{
var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ??
var node = doc.SelectSingleNode("//fanart/series/hdtvlogos/hdtvlogo[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo/@url") ??
doc.SelectSingleNode("//fanart/series/hdtvlogos/hdtvlogo/@url") ??
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo/@url");
var path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))
@ -233,12 +232,11 @@ namespace MediaBrowser.Providers.TV
cancellationToken.ThrowIfCancellationRequested();
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
{
var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ??
var node = doc.SelectSingleNode("//fanart/series/hdcleararts/hdclearart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart/@url") ??
doc.SelectSingleNode("//fanart/series/hdcleararts/hdclearart/@url") ??
doc.SelectSingleNode("//fanart/series/cleararts/clearart/@url");
var path = node != null ? node.Value : null;
if (!string.IsNullOrEmpty(path))