|
|
|
@ -14,6 +14,8 @@ using NzbDrone.Core.Tv;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using NzbDrone.Core.Parser;
|
|
|
|
|
using NzbDrone.Core.Profiles;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.MetadataSource.SkyHook
|
|
|
|
|
{
|
|
|
|
@ -67,25 +69,39 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|
|
|
|
return new Tuple<Series, List<Episode>>(series, episodes.ToList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Movie GetMovieInfo(int TmdbId)
|
|
|
|
|
public Movie GetMovieInfo(int TmdbId, Profile profile = null)
|
|
|
|
|
{
|
|
|
|
|
var langCode = profile != null ? IsoLanguages.Get(profile.Language).TwoLetterCode : "us";
|
|
|
|
|
|
|
|
|
|
var request = _movieBuilder.Create()
|
|
|
|
|
.SetSegment("route", "movie")
|
|
|
|
|
.SetSegment("id", TmdbId.ToString())
|
|
|
|
|
.SetSegment("secondaryRoute", "")
|
|
|
|
|
.AddQueryParam("append_to_response", "alternative_titles,release_dates,videos")
|
|
|
|
|
.AddQueryParam("country", "US")
|
|
|
|
|
.AddQueryParam("language", langCode.ToUpper())
|
|
|
|
|
// .AddQueryParam("country", "US")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
request.AllowAutoRedirect = true;
|
|
|
|
|
request.SuppressHttpError = true;
|
|
|
|
|
|
|
|
|
|
var response = _httpClient.Get<MovieResourceRoot>(request);
|
|
|
|
|
|
|
|
|
|
var resource = response.Resource;
|
|
|
|
|
|
|
|
|
|
var movie = new Movie();
|
|
|
|
|
|
|
|
|
|
foreach (var alternativeTitle in resource.alternative_titles.titles)
|
|
|
|
|
{
|
|
|
|
|
if (alternativeTitle.iso_3166_1.ToLower() == langCode)
|
|
|
|
|
{
|
|
|
|
|
movie.AlternativeTitles.Add(alternativeTitle.title);
|
|
|
|
|
}
|
|
|
|
|
else if (alternativeTitle.iso_3166_1.ToLower() == "us")
|
|
|
|
|
{
|
|
|
|
|
movie.AlternativeTitles.Add(alternativeTitle.title);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
movie.TmdbId = TmdbId;
|
|
|
|
|
movie.ImdbId = resource.imdb_id;
|
|
|
|
|
movie.Title = resource.title;
|
|
|
|
@ -106,10 +122,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|
|
|
|
movie.Images.Add(_configService.GetCoverForURL(resource.backdrop_path, MediaCoverTypes.Banner));
|
|
|
|
|
movie.Runtime = resource.runtime;
|
|
|
|
|
|
|
|
|
|
foreach(Title title in resource.alternative_titles.titles)
|
|
|
|
|
{
|
|
|
|
|
movie.AlternativeTitles.Add(title.title);
|
|
|
|
|
}
|
|
|
|
|
//foreach(Title title in resource.alternative_titles.titles)
|
|
|
|
|
//{
|
|
|
|
|
// movie.AlternativeTitles.Add(title.title);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
foreach(ReleaseDates releaseDates in resource.release_dates.results)
|
|
|
|
|
{
|
|
|
|
|