Ombi/src/Ombi.Helpers/PosterPathHelper.cs
Anojh Thayaparan 025797c1ba added background property to tvrequests API (#2172)
* Added background property to TvRequests

* set background property for new requests and display in UI
2018-04-19 08:05:49 +01:00

36 lines
1.1 KiB
C#

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;
}
public static string FixBackgroundPath(string background)
{
// https://image.tmdb.org/t/p/w1280/fJAvGOitU8y53ByeHnM4avtKFaG.jpg
if (background.Contains("image.tmdb.org", CompareOptions.IgnoreCase))
{
// Somehow we have a full path here for the poster, we only want the last segment
var backgroundSegments = background.Split('/');
return backgroundSegments.Last();
}
return background;
}
}
}