瀏覽代碼

fixed saving images with double file extension

Luke Pulverenti 11 年之前
父節點
當前提交
9c56495867

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

@@ -239,12 +239,6 @@ namespace MediaBrowser.Model.Configuration
         /// <value>The width of the min movie poster.</value>
         /// <value>The width of the min movie poster.</value>
         public int MinMoviePosterWidth { get; set; }
         public int MinMoviePosterWidth { get; set; }
         
         
-        /// <summary>
-        /// Gets or sets the width of the min series backdrop.
-        /// </summary>
-        /// <value>The width of the min series backdrop.</value>
-        public int MinSeriesBackdropWidth { get; set; }
-        
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// </summary>
         /// </summary>
@@ -292,7 +286,6 @@ namespace MediaBrowser.Model.Configuration
             SeasonZeroDisplayName = "Specials";
             SeasonZeroDisplayName = "Specials";
 
 
             MinMovieBackdropWidth = 1920;
             MinMovieBackdropWidth = 1920;
-            MinSeriesBackdropWidth = 1920;
             MinMoviePosterWidth = 1000;
             MinMoviePosterWidth = 1000;
         }
         }
     }
     }

+ 1 - 1
MediaBrowser.Model/Entities/IHasMediaStreams.cs

@@ -21,6 +21,6 @@ namespace MediaBrowser.Model.Entities
         /// Gets or sets the primary image path.
         /// Gets or sets the primary image path.
         /// </summary>
         /// </summary>
         /// <value>The primary image path.</value>
         /// <value>The primary image path.</value>
-        string PrimaryImagePath { get; set; }
+        string PrimaryImagePath { get; }
     }
     }
 }
 }

+ 13 - 9
MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs

@@ -202,11 +202,13 @@ namespace MediaBrowser.Providers.Movies
 
 
             var status = ProviderRefreshStatus.Success;
             var status = ProviderRefreshStatus.Success;
 
 
-            var eligiblePosters = images.posters == null ? 
-                new List<Poster>() : 
+            var eligiblePosters = images.posters == null ?
+                new List<Poster>() :
                 images.posters.Where(i => i.width >= ConfigurationManager.Configuration.MinMoviePosterWidth)
                 images.posters.Where(i => i.width >= ConfigurationManager.Configuration.MinMoviePosterWidth)
                 .ToList();
                 .ToList();
 
 
+            eligiblePosters = eligiblePosters.OrderByDescending(i => i.vote_average).ToList();
+
             //        poster
             //        poster
             if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary))
             if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary))
             {
             {
@@ -215,24 +217,26 @@ namespace MediaBrowser.Providers.Movies
                 var tmdbImageUrl = tmdbSettings.images.base_url + "original";
                 var tmdbImageUrl = tmdbSettings.images.base_url + "original";
                 // get highest rated poster for our language
                 // get highest rated poster for our language
 
 
-                var postersSortedByVote = eligiblePosters.OrderByDescending(i => i.vote_average);
+                var poster = eligiblePosters.FirstOrDefault(p => string.Equals(p.iso_639_1, ConfigurationManager.Configuration.PreferredMetadataLanguage, StringComparison.OrdinalIgnoreCase));
 
 
-                var poster = postersSortedByVote.FirstOrDefault(p => p.iso_639_1 != null && p.iso_639_1.Equals(ConfigurationManager.Configuration.PreferredMetadataLanguage, StringComparison.OrdinalIgnoreCase));
-                if (poster == null && !ConfigurationManager.Configuration.PreferredMetadataLanguage.Equals("en"))
+                if (poster == null)
                 {
                 {
-                    // couldn't find our specific language, find english (if that wasn't our language)
-                    poster = postersSortedByVote.FirstOrDefault(p => p.iso_639_1 != null && p.iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase));
+                    // couldn't find our specific language, find english
+                    poster = eligiblePosters.FirstOrDefault(p => string.Equals(p.iso_639_1, "en", StringComparison.OrdinalIgnoreCase));
                 }
                 }
+
                 if (poster == null)
                 if (poster == null)
                 {
                 {
                     //still couldn't find it - try highest rated null one
                     //still couldn't find it - try highest rated null one
-                    poster = postersSortedByVote.FirstOrDefault(p => p.iso_639_1 == null);
+                    poster = eligiblePosters.FirstOrDefault(p => p.iso_639_1 == null);
                 }
                 }
+
                 if (poster == null)
                 if (poster == null)
                 {
                 {
                     //finally - just get the highest rated one
                     //finally - just get the highest rated one
-                    poster = postersSortedByVote.FirstOrDefault();
+                    poster = eligiblePosters.FirstOrDefault();
                 }
                 }
+
                 if (poster != null)
                 if (poster != null)
                 {
                 {
                     var img = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
                     var img = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions

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

@@ -338,7 +338,7 @@ namespace MediaBrowser.Providers.Music
                 if (nodes != null)
                 if (nodes != null)
                 {
                 {
                     var numBackdrops = 0;
                     var numBackdrops = 0;
-                    item.BackdropImagePaths.Clear();
+
                     foreach (XmlNode node in nodes)
                     foreach (XmlNode node in nodes)
                     {
                     {
                         path = node.Value;
                         path = node.Value;

+ 3 - 3
MediaBrowser.Server.Implementations/Providers/ImageSaver.cs

@@ -341,8 +341,6 @@ namespace MediaBrowser.Server.Implementations.Providers
                 extension = "jpg";
                 extension = "jpg";
             }
             }
 
 
-            filename += "." + extension.ToLower();
-
             string path = null;
             string path = null;
 
 
             if (saveLocally)
             if (saveLocally)
@@ -354,10 +352,12 @@ namespace MediaBrowser.Server.Implementations.Providers
 
 
                 if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(item.MetaLocation))
                 if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(item.MetaLocation))
                 {
                 {
-                    path = Path.Combine(item.MetaLocation, filename);
+                    path = Path.Combine(item.MetaLocation, filename + extension.ToLower());
                 }
                 }
             }
             }
 
 
+            filename += "." + extension.ToLower();
+
             // None of the save local conditions passed, so store it in our internal folders
             // None of the save local conditions passed, so store it in our internal folders
             if (string.IsNullOrEmpty(path))
             if (string.IsNullOrEmpty(path))
             {
             {