Browse Source

update to fanart api changes

Luke Pulverenti 11 years ago
parent
commit
9bfe68c535

+ 0 - 7
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -136,12 +136,6 @@ namespace MediaBrowser.Model.Configuration
         /// </summary>
         /// </summary>
         public ImageDownloadOptions DownloadMusicAlbumImages { get; set; }
         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>
         /// <summary>
         /// Characters to be replaced with a ' ' in strings to create a sort name
         /// Characters to be replaced with a ' ' in strings to create a sort name
         /// </summary>
         /// </summary>
@@ -273,7 +267,6 @@ namespace MediaBrowser.Model.Configuration
             DownloadSeasonImages = new ImageDownloadOptions();
             DownloadSeasonImages = new ImageDownloadOptions();
             DownloadMusicArtistImages = new ImageDownloadOptions();
             DownloadMusicArtistImages = new ImageDownloadOptions();
             DownloadMusicAlbumImages = new ImageDownloadOptions();
             DownloadMusicAlbumImages = new ImageDownloadOptions();
-            DownloadHDFanArt = true;
             MaxBackdrops = 3;
             MaxBackdrops = 3;
 
 
             SortReplaceCharacters = new[] { ".", "+", "%" };
             SortReplaceCharacters = new[] { ".", "+", "%" };

+ 12 - 12
MediaBrowser.Providers/Movies/FanArtMovieProvider.cs

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

+ 1 - 1
MediaBrowser.Providers/Movies/MovieDbProvider.cs

@@ -197,7 +197,7 @@ namespace MediaBrowser.Providers.Movies
                 return false;
                 return false;
 
 
             // Boxsets require two passes because we need the children to be refreshed
             // 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;
                 return true;
             }
             }

+ 4 - 4
MediaBrowser.Providers/Music/FanArtArtistProvider.cs

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

+ 4 - 6
MediaBrowser.Providers/TV/FanArtTVProvider.cs

@@ -216,12 +216,11 @@ namespace MediaBrowser.Providers.TV
 
 
             var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
             var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
             
             
-            var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
             if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
             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/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");
                             doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo/@url");
                 var path = node != null ? node.Value : null;
                 var path = node != null ? node.Value : null;
                 if (!string.IsNullOrEmpty(path))
                 if (!string.IsNullOrEmpty(path))
@@ -233,12 +232,11 @@ namespace MediaBrowser.Providers.TV
 
 
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
-            hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
             if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
             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/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");
                            doc.SelectSingleNode("//fanart/series/cleararts/clearart/@url");
                 var path = node != null ? node.Value : null;
                 var path = node != null ? node.Value : null;
                 if (!string.IsNullOrEmpty(path))
                 if (!string.IsNullOrEmpty(path))