From 9bfe68c5354033f7595bed3365fe41070486cb14 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 13 Oct 2013 15:22:55 -0400 Subject: [PATCH] update to fanart api changes --- .../Configuration/ServerConfiguration.cs | 7 ------ .../Movies/FanArtMovieProvider.cs | 24 +++++++++---------- .../Movies/MovieDbProvider.cs | 2 +- .../Music/FanArtArtistProvider.cs | 8 +++---- MediaBrowser.Providers/TV/FanArtTVProvider.cs | 10 ++++---- 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 0d4f18f3a..656393585 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -136,12 +136,6 @@ namespace MediaBrowser.Model.Configuration /// public ImageDownloadOptions DownloadMusicAlbumImages { get; set; } - /// - /// Gets or sets a value indicating whether [download TV season backdrops]. - /// - /// true if [download TV season banner]; otherwise, false. - public bool DownloadHDFanArt { get; set; } - /// /// Characters to be replaced with a ' ' in strings to create a sort name /// @@ -273,7 +267,6 @@ namespace MediaBrowser.Model.Configuration DownloadSeasonImages = new ImageDownloadOptions(); DownloadMusicArtistImages = new ImageDownloadOptions(); DownloadMusicAlbumImages = new ImageDownloadOptions(); - DownloadHDFanArt = true; MaxBackdrops = 3; SortReplaceCharacters = new[] { ".", "+", "%" }; diff --git a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs index ddc15a612..1e1b6830a 100644 --- a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs +++ b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs @@ -68,7 +68,7 @@ namespace MediaBrowser.Providers.Movies return ItemUpdateType.ImageUpdate; } } - + /// /// Gets a value indicating whether [refresh on version change]. /// @@ -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); } /// @@ -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; diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index c61e37bde..57c9b1555 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -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; } diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs index 8013ddd3c..441fb4b09 100644 --- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs @@ -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)) diff --git a/MediaBrowser.Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Providers/TV/FanArtTVProvider.cs index bf0651432..bfa1379a8 100644 --- a/MediaBrowser.Providers/TV/FanArtTVProvider.cs +++ b/MediaBrowser.Providers/TV/FanArtTVProvider.cs @@ -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))