Added a fix for the poster path issue #1533

This commit is contained in:
Jamie.Rees 2017-10-06 08:12:31 +01:00
parent f5a0572946
commit 462bbcc4a6
2 changed files with 23 additions and 1 deletions

View file

@ -64,7 +64,7 @@ namespace Ombi.Core.Engine
RequestType = RequestType.Movie, RequestType = RequestType.Movie,
Overview = movieInfo.Overview, Overview = movieInfo.Overview,
ImdbId = movieInfo.ImdbId, ImdbId = movieInfo.ImdbId,
PosterPath = movieInfo.PosterPath.TrimStart('/'), PosterPath = PosterPathHelper.FixPosterPath(movieInfo.PosterPath.TrimStart('/')),
Title = movieInfo.Title, Title = movieInfo.Title,
ReleaseDate = !string.IsNullOrEmpty(movieInfo.ReleaseDate) ReleaseDate = !string.IsNullOrEmpty(movieInfo.ReleaseDate)
? DateTime.Parse(movieInfo.ReleaseDate) ? DateTime.Parse(movieInfo.ReleaseDate)

View file

@ -0,0 +1,22 @@
using System.Globalization;
using System.Linq;
namespace Ombi.Helpers
{
public class PosterPathHelper
{
public static string FixPosterPath(string poster)
{
// https://image.tmdb.org/t/p/w150/fJAvGOitU8y53ByeHnM4avtKFaG.jpg
if (poster.Contains("image.tmdb.org", CompareOptions.IgnoreCase))
{
// Somehow we have a full path here for the poster, we only want the last segment
var posterSegments = poster.Split('/');
return posterSegments.Last();
}
return poster;
}
}
}