fixed saving images with double file extension

pull/702/head
Luke Pulverenti 11 years ago
parent 42deac1dce
commit 9c56495867

@ -239,12 +239,6 @@ namespace MediaBrowser.Model.Configuration
/// <value>The width of the min movie poster.</value>
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>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@ -292,7 +286,6 @@ namespace MediaBrowser.Model.Configuration
SeasonZeroDisplayName = "Specials";
MinMovieBackdropWidth = 1920;
MinSeriesBackdropWidth = 1920;
MinMoviePosterWidth = 1000;
}
}

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

@ -202,11 +202,13 @@ namespace MediaBrowser.Providers.Movies
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)
.ToList();
eligiblePosters = eligiblePosters.OrderByDescending(i => i.vote_average).ToList();
// poster
if (eligiblePosters.Count > 0 && !item.HasImage(ImageType.Primary))
{
@ -215,24 +217,26 @@ namespace MediaBrowser.Providers.Movies
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
// 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)
{
//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)
{
//finally - just get the highest rated one
poster = postersSortedByVote.FirstOrDefault();
poster = eligiblePosters.FirstOrDefault();
}
if (poster != null)
{
var img = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions

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

@ -341,8 +341,6 @@ namespace MediaBrowser.Server.Implementations.Providers
extension = "jpg";
}
filename += "." + extension.ToLower();
string path = null;
if (saveLocally)
@ -354,10 +352,12 @@ namespace MediaBrowser.Server.Implementations.Providers
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
if (string.IsNullOrEmpty(path))
{

Loading…
Cancel
Save