fixed saving images with double file extension

This commit is contained in:
Luke Pulverenti 2013-10-22 08:37:11 -04:00
parent 42deac1dce
commit 9c56495867
5 changed files with 18 additions and 21 deletions

View File

@ -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;
} }
} }

View File

@ -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; }
} }
} }

View File

@ -202,11 +202,13 @@ namespace MediaBrowser.Providers.Movies
var status = ProviderRefreshStatus.Success; var status = ProviderRefreshStatus.Success;
var eligiblePosters = images.posters == null ? var eligiblePosters = images.posters == null ?
new List<Poster>() : 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)
if (poster == null && !ConfigurationManager.Configuration.PreferredMetadataLanguage.Equals("en"))
{ {
// couldn't find our specific language, find english (if that wasn't our language) // couldn't find our specific language, find english
poster = postersSortedByVote.FirstOrDefault(p => p.iso_639_1 != null && p.iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)); 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

View File

@ -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;

View File

@ -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))
{ {