|
|
@ -27,9 +27,6 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
|
|
|
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private const string GetTvInfo3 = TmdbUtils.BaseTmdbApiUrl + @"3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos,content_ratings";
|
|
|
|
private const string GetTvInfo3 = TmdbUtils.BaseTmdbApiUrl + @"3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos,content_ratings";
|
|
|
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal static TmdbSeriesProvider Current { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IJsonSerializer _jsonSerializer;
|
|
|
|
private readonly IJsonSerializer _jsonSerializer;
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
|
private readonly IFileSystem _fileSystem;
|
|
|
@ -39,6 +36,10 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
private readonly IHttpClient _httpClient;
|
|
|
|
private readonly IHttpClient _httpClient;
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal static TmdbSeriesProvider Current { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
public TmdbSeriesProvider(
|
|
|
|
public TmdbSeriesProvider(
|
|
|
|
IJsonSerializer jsonSerializer,
|
|
|
|
IJsonSerializer jsonSerializer,
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
IFileSystem fileSystem,
|
|
|
@ -217,10 +218,9 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
var series = seriesResult.Item;
|
|
|
|
var series = seriesResult.Item;
|
|
|
|
|
|
|
|
|
|
|
|
series.Name = seriesInfo.Name;
|
|
|
|
series.Name = seriesInfo.Name;
|
|
|
|
|
|
|
|
series.OriginalTitle = seriesInfo.Original_Name;
|
|
|
|
series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.Id.ToString(_usCulture));
|
|
|
|
series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.Id.ToString(_usCulture));
|
|
|
|
|
|
|
|
|
|
|
|
//series.VoteCount = seriesInfo.vote_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string voteAvg = seriesInfo.Vote_Average.ToString(CultureInfo.InvariantCulture);
|
|
|
|
string voteAvg = seriesInfo.Vote_Average.ToString(CultureInfo.InvariantCulture);
|
|
|
|
|
|
|
|
|
|
|
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out float rating))
|
|
|
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out float rating))
|
|
|
@ -240,7 +240,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
series.Genres = seriesInfo.Genres.Select(i => i.Name).ToArray();
|
|
|
|
series.Genres = seriesInfo.Genres.Select(i => i.Name).ToArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//series.HomePageUrl = seriesInfo.homepage;
|
|
|
|
series.HomePageUrl = seriesInfo.Homepage;
|
|
|
|
|
|
|
|
|
|
|
|
series.RunTimeTicks = seriesInfo.Episode_Run_Time.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault();
|
|
|
|
series.RunTimeTicks = seriesInfo.Episode_Run_Time.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
@ -308,7 +308,9 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
seriesResult.ResetPeople();
|
|
|
|
seriesResult.ResetPeople();
|
|
|
|
var tmdbImageUrl = settings.images.GetImageUrl("original");
|
|
|
|
var tmdbImageUrl = settings.images.GetImageUrl("original");
|
|
|
|
|
|
|
|
|
|
|
|
if (seriesInfo.Credits != null && seriesInfo.Credits.Cast != null)
|
|
|
|
if (seriesInfo.Credits != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (seriesInfo.Credits.Cast != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var actor in seriesInfo.Credits.Cast.OrderBy(a => a.Order))
|
|
|
|
foreach (var actor in seriesInfo.Credits.Cast.OrderBy(a => a.Order))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -333,6 +335,36 @@ namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
|
seriesResult.AddPerson(personInfo);
|
|
|
|
seriesResult.AddPerson(personInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (seriesInfo.Credits.Crew != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var keepTypes = new[]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PersonType.Director,
|
|
|
|
|
|
|
|
PersonType.Writer,
|
|
|
|
|
|
|
|
PersonType.Producer
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var person in seriesInfo.Credits.Crew)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Normalize this
|
|
|
|
|
|
|
|
var type = TmdbUtils.MapCrewToPersonType(person);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase)
|
|
|
|
|
|
|
|
&& !keepTypes.Contains(person.Job ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seriesResult.AddPerson(new PersonInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Name = person.Name.Trim(),
|
|
|
|
|
|
|
|
Role = person.Job,
|
|
|
|
|
|
|
|
Type = type
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static string GetSeriesDataPath(IApplicationPaths appPaths, string tmdbId)
|
|
|
|
internal static string GetSeriesDataPath(IApplicationPaths appPaths, string tmdbId)
|
|
|
|