|
@@ -18,16 +18,19 @@ using MediaBrowser.Model.IO;
|
|
|
using MediaBrowser.Model.Providers;
|
|
|
using MediaBrowser.Model.Serialization;
|
|
|
using MediaBrowser.Providers.Movies;
|
|
|
+using MediaBrowser.Providers.Tmdb.Models.Search;
|
|
|
+using MediaBrowser.Providers.Tmdb.Models.TV;
|
|
|
+using MediaBrowser.Providers.Tmdb.Movies;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
-namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
+namespace MediaBrowser.Providers.Tmdb.TV
|
|
|
{
|
|
|
- public class MovieDbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
|
|
+ public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
|
|
{
|
|
|
- private const string GetTvInfo3 = MovieDbProvider.BaseMovieDbUrl + @"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 MovieDbSeriesProvider Current { get; private set; }
|
|
|
+ internal static TmdbSeriesProvider Current { get; private set; }
|
|
|
|
|
|
private readonly IJsonSerializer _jsonSerializer;
|
|
|
private readonly IFileSystem _fileSystem;
|
|
@@ -37,7 +40,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
private readonly IHttpClient _httpClient;
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
|
- public MovieDbSeriesProvider(IJsonSerializer jsonSerializer, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
|
|
+ public TmdbSeriesProvider(IJsonSerializer jsonSerializer, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
|
|
{
|
|
|
_jsonSerializer = jsonSerializer;
|
|
|
_fileSystem = fileSystem;
|
|
@@ -49,7 +52,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
Current = this;
|
|
|
}
|
|
|
|
|
|
- public string Name => "TheMovieDb";
|
|
|
+ public string Name => TmdbUtils.ProviderName;
|
|
|
|
|
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
|
|
{
|
|
@@ -63,24 +66,24 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
|
|
|
var dataFilePath = GetDataFilePath(tmdbId, searchInfo.MetadataLanguage);
|
|
|
|
|
|
- var obj = _jsonSerializer.DeserializeFromFile<RootObject>(dataFilePath);
|
|
|
+ var obj = _jsonSerializer.DeserializeFromFile<SeriesResult>(dataFilePath);
|
|
|
|
|
|
- var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
+ var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
|
|
|
|
|
var remoteResult = new RemoteSearchResult
|
|
|
{
|
|
|
- Name = obj.name,
|
|
|
+ Name = obj.Name,
|
|
|
SearchProviderName = Name,
|
|
|
- ImageUrl = string.IsNullOrWhiteSpace(obj.poster_path) ? null : tmdbImageUrl + obj.poster_path
|
|
|
+ ImageUrl = string.IsNullOrWhiteSpace(obj.Poster_Path) ? null : tmdbImageUrl + obj.Poster_Path
|
|
|
};
|
|
|
|
|
|
- remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture));
|
|
|
- remoteResult.SetProviderId(MetadataProviders.Imdb, obj.external_ids.imdb_id);
|
|
|
+ remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.Id.ToString(_usCulture));
|
|
|
+ remoteResult.SetProviderId(MetadataProviders.Imdb, obj.External_Ids.Imdb_Id);
|
|
|
|
|
|
- if (obj.external_ids.tvdb_id > 0)
|
|
|
+ if (obj.External_Ids.Tvdb_Id > 0)
|
|
|
{
|
|
|
- remoteResult.SetProviderId(MetadataProviders.Tvdb, obj.external_ids.tvdb_id.ToString(_usCulture));
|
|
|
+ remoteResult.SetProviderId(MetadataProviders.Tvdb, obj.External_Ids.Tvdb_Id.ToString(_usCulture));
|
|
|
}
|
|
|
|
|
|
return new[] { remoteResult };
|
|
@@ -110,7 +113,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
|
|
+ return await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
|
|
}
|
|
|
|
|
|
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
|
@@ -153,7 +156,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
if (string.IsNullOrEmpty(tmdbId))
|
|
|
{
|
|
|
result.QueriedById = false;
|
|
|
- var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
|
|
|
+ var searchResults = await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
var searchResult = searchResults.FirstOrDefault();
|
|
|
|
|
@@ -177,14 +180,14 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
|
|
|
private async Task<MetadataResult<Series>> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- RootObject seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
|
|
+ SeriesResult seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
if (seriesInfo == null)
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- tmdbId = seriesInfo.id.ToString(_usCulture);
|
|
|
+ tmdbId = seriesInfo.Id.ToString(_usCulture);
|
|
|
|
|
|
string dataFilePath = GetDataFilePath(tmdbId, language);
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
|
@@ -196,102 +199,102 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
result.Item = new Series();
|
|
|
result.ResultLanguage = seriesInfo.ResultLanguage;
|
|
|
|
|
|
- var settings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
+ var settings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
ProcessMainInfo(result, seriesInfo, preferredCountryCode, settings);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private void ProcessMainInfo(MetadataResult<Series> seriesResult, RootObject seriesInfo, string preferredCountryCode, TmdbSettingsResult settings)
|
|
|
+ private void ProcessMainInfo(MetadataResult<Series> seriesResult, SeriesResult seriesInfo, string preferredCountryCode, TmdbSettingsResult settings)
|
|
|
{
|
|
|
var series = seriesResult.Item;
|
|
|
|
|
|
- series.Name = seriesInfo.name;
|
|
|
- series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture));
|
|
|
+ series.Name = seriesInfo.Name;
|
|
|
+ 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))
|
|
|
{
|
|
|
series.CommunityRating = rating;
|
|
|
}
|
|
|
|
|
|
- series.Overview = seriesInfo.overview;
|
|
|
+ series.Overview = seriesInfo.Overview;
|
|
|
|
|
|
- if (seriesInfo.networks != null)
|
|
|
+ if (seriesInfo.Networks != null)
|
|
|
{
|
|
|
- series.Studios = seriesInfo.networks.Select(i => i.name).ToArray();
|
|
|
+ series.Studios = seriesInfo.Networks.Select(i => i.Name).ToArray();
|
|
|
}
|
|
|
|
|
|
- if (seriesInfo.genres != null)
|
|
|
+ if (seriesInfo.Genres != null)
|
|
|
{
|
|
|
- series.Genres = seriesInfo.genres.Select(i => i.name).ToArray();
|
|
|
+ series.Genres = seriesInfo.Genres.Select(i => i.Name).ToArray();
|
|
|
}
|
|
|
|
|
|
//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();
|
|
|
|
|
|
- if (string.Equals(seriesInfo.status, "Ended", StringComparison.OrdinalIgnoreCase))
|
|
|
+ if (string.Equals(seriesInfo.Status, "Ended", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
series.Status = SeriesStatus.Ended;
|
|
|
- series.EndDate = seriesInfo.last_air_date;
|
|
|
+ series.EndDate = seriesInfo.Last_Air_Date;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
series.Status = SeriesStatus.Continuing;
|
|
|
}
|
|
|
|
|
|
- series.PremiereDate = seriesInfo.first_air_date;
|
|
|
+ series.PremiereDate = seriesInfo.First_Air_Date;
|
|
|
|
|
|
- var ids = seriesInfo.external_ids;
|
|
|
+ var ids = seriesInfo.External_Ids;
|
|
|
if (ids != null)
|
|
|
{
|
|
|
- if (!string.IsNullOrWhiteSpace(ids.imdb_id))
|
|
|
+ if (!string.IsNullOrWhiteSpace(ids.Imdb_Id))
|
|
|
{
|
|
|
- series.SetProviderId(MetadataProviders.Imdb, ids.imdb_id);
|
|
|
+ series.SetProviderId(MetadataProviders.Imdb, ids.Imdb_Id);
|
|
|
}
|
|
|
- if (ids.tvrage_id > 0)
|
|
|
+ if (ids.Tvrage_Id > 0)
|
|
|
{
|
|
|
- series.SetProviderId(MetadataProviders.TvRage, ids.tvrage_id.ToString(_usCulture));
|
|
|
+ series.SetProviderId(MetadataProviders.TvRage, ids.Tvrage_Id.ToString(_usCulture));
|
|
|
}
|
|
|
- if (ids.tvdb_id > 0)
|
|
|
+ if (ids.Tvdb_Id > 0)
|
|
|
{
|
|
|
- series.SetProviderId(MetadataProviders.Tvdb, ids.tvdb_id.ToString(_usCulture));
|
|
|
+ series.SetProviderId(MetadataProviders.Tvdb, ids.Tvdb_Id.ToString(_usCulture));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var contentRatings = (seriesInfo.content_ratings ?? new ContentRatings()).results ?? new List<ContentRating>();
|
|
|
+ var contentRatings = (seriesInfo.Content_Ratings ?? new ContentRatings()).Results ?? new List<ContentRating>();
|
|
|
|
|
|
- var ourRelease = contentRatings.FirstOrDefault(c => string.Equals(c.iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase));
|
|
|
- var usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));
|
|
|
+ var ourRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase));
|
|
|
+ var usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));
|
|
|
var minimumRelease = contentRatings.FirstOrDefault();
|
|
|
|
|
|
if (ourRelease != null)
|
|
|
{
|
|
|
- series.OfficialRating = ourRelease.rating;
|
|
|
+ series.OfficialRating = ourRelease.Rating;
|
|
|
}
|
|
|
else if (usRelease != null)
|
|
|
{
|
|
|
- series.OfficialRating = usRelease.rating;
|
|
|
+ series.OfficialRating = usRelease.Rating;
|
|
|
}
|
|
|
else if (minimumRelease != null)
|
|
|
{
|
|
|
- series.OfficialRating = minimumRelease.rating;
|
|
|
+ series.OfficialRating = minimumRelease.Rating;
|
|
|
}
|
|
|
|
|
|
- if (seriesInfo.videos != null && seriesInfo.videos.results != null)
|
|
|
+ if (seriesInfo.Videos != null && seriesInfo.Videos.Results != null)
|
|
|
{
|
|
|
- foreach (var video in seriesInfo.videos.results)
|
|
|
+ foreach (var video in seriesInfo.Videos.Results)
|
|
|
{
|
|
|
- if ((video.type.Equals("trailer", StringComparison.OrdinalIgnoreCase)
|
|
|
- || video.type.Equals("clip", StringComparison.OrdinalIgnoreCase))
|
|
|
- && video.site.Equals("youtube", StringComparison.OrdinalIgnoreCase))
|
|
|
+ if ((video.Type.Equals("trailer", StringComparison.OrdinalIgnoreCase)
|
|
|
+ || video.Type.Equals("clip", StringComparison.OrdinalIgnoreCase))
|
|
|
+ && video.Site.Equals("youtube", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.key}");
|
|
|
+ series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.Key}");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -299,26 +302,26 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
seriesResult.ResetPeople();
|
|
|
var tmdbImageUrl = settings.images.GetImageUrl("original");
|
|
|
|
|
|
- if (seriesInfo.credits != null && seriesInfo.credits.cast != null)
|
|
|
+ if (seriesInfo.Credits != null && 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))
|
|
|
{
|
|
|
var personInfo = new PersonInfo
|
|
|
{
|
|
|
- Name = actor.name.Trim(),
|
|
|
- Role = actor.character,
|
|
|
+ Name = actor.Name.Trim(),
|
|
|
+ Role = actor.Character,
|
|
|
Type = PersonType.Actor,
|
|
|
- SortOrder = actor.order
|
|
|
+ SortOrder = actor.Order
|
|
|
};
|
|
|
|
|
|
- if (!string.IsNullOrWhiteSpace(actor.profile_path))
|
|
|
+ if (!string.IsNullOrWhiteSpace(actor.Profile_Path))
|
|
|
{
|
|
|
- personInfo.ImageUrl = tmdbImageUrl + actor.profile_path;
|
|
|
+ personInfo.ImageUrl = tmdbImageUrl + actor.Profile_Path;
|
|
|
}
|
|
|
|
|
|
- if (actor.id > 0)
|
|
|
+ if (actor.Id > 0)
|
|
|
{
|
|
|
- personInfo.SetProviderId(MetadataProviders.Tmdb, actor.id.ToString(CultureInfo.InvariantCulture));
|
|
|
+ personInfo.SetProviderId(MetadataProviders.Tmdb, actor.Id.ToString(CultureInfo.InvariantCulture));
|
|
|
}
|
|
|
|
|
|
seriesResult.AddPerson(personInfo);
|
|
@@ -342,7 +345,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
|
|
|
internal async Task DownloadSeriesInfo(string id, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- RootObject mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
|
|
+ SeriesResult mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
if (mainResult == null)
|
|
|
{
|
|
@@ -356,31 +359,31 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
|
|
|
}
|
|
|
|
|
|
- internal async Task<RootObject> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
|
|
+ internal async Task<SeriesResult> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey);
|
|
|
+ var url = string.Format(GetTvInfo3, id, TmdbUtils.ApiKey);
|
|
|
|
|
|
if (!string.IsNullOrEmpty(language))
|
|
|
{
|
|
|
- url += "&language=" + MovieDbProvider.NormalizeLanguage(language)
|
|
|
- + "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
|
|
+ url += "&language=" + TmdbMovieProvider.NormalizeLanguage(language)
|
|
|
+ + "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
|
|
}
|
|
|
|
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
|
|
- RootObject mainResult;
|
|
|
+ SeriesResult mainResult;
|
|
|
|
|
|
- using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
+ using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
{
|
|
|
Url = url,
|
|
|
CancellationToken = cancellationToken,
|
|
|
- AcceptHeader = MovieDbProvider.AcceptHeader
|
|
|
+ AcceptHeader = TmdbUtils.AcceptHeader
|
|
|
|
|
|
}).ConfigureAwait(false))
|
|
|
{
|
|
|
using (var json = response.Content)
|
|
|
{
|
|
|
- mainResult = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
|
|
+ mainResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false);
|
|
|
|
|
|
if (!string.IsNullOrEmpty(language))
|
|
|
{
|
|
@@ -393,33 +396,33 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
|
|
|
// If the language preference isn't english, then have the overview fallback to english if it's blank
|
|
|
if (mainResult != null &&
|
|
|
- string.IsNullOrEmpty(mainResult.overview) &&
|
|
|
+ string.IsNullOrEmpty(mainResult.Overview) &&
|
|
|
!string.IsNullOrEmpty(language) &&
|
|
|
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language {Language}. Trying English...", language);
|
|
|
|
|
|
- url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey) + "&language=en";
|
|
|
+ url = string.Format(GetTvInfo3, id, TmdbUtils.ApiKey) + "&language=en";
|
|
|
|
|
|
if (!string.IsNullOrEmpty(language))
|
|
|
{
|
|
|
// Get images in english and with no language
|
|
|
- url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
|
|
+ url += "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language);
|
|
|
}
|
|
|
|
|
|
- using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
+ using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
{
|
|
|
Url = url,
|
|
|
CancellationToken = cancellationToken,
|
|
|
- AcceptHeader = MovieDbProvider.AcceptHeader
|
|
|
+ AcceptHeader = TmdbUtils.AcceptHeader
|
|
|
|
|
|
}).ConfigureAwait(false))
|
|
|
{
|
|
|
using (var json = response.Content)
|
|
|
{
|
|
|
- var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
|
|
+ var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false);
|
|
|
|
|
|
- mainResult.overview = englishResult.overview;
|
|
|
+ mainResult.Overview = englishResult.Overview;
|
|
|
mainResult.ResultLanguage = "en";
|
|
|
}
|
|
|
}
|
|
@@ -467,40 +470,40 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
|
|
|
private async Task<RemoteSearchResult> FindByExternalId(string id, string externalSource, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- var url = string.Format(MovieDbProvider.BaseMovieDbUrl + @"3/find/{0}?api_key={1}&external_source={2}",
|
|
|
+ var url = string.Format(TmdbUtils.BaseTmdbApiUrl + @"3/find/{0}?api_key={1}&external_source={2}",
|
|
|
id,
|
|
|
- MovieDbProvider.ApiKey,
|
|
|
+ TmdbUtils.ApiKey,
|
|
|
externalSource);
|
|
|
|
|
|
- using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
+ using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
|
|
{
|
|
|
Url = url,
|
|
|
CancellationToken = cancellationToken,
|
|
|
- AcceptHeader = MovieDbProvider.AcceptHeader
|
|
|
+ AcceptHeader = TmdbUtils.AcceptHeader
|
|
|
|
|
|
}).ConfigureAwait(false))
|
|
|
{
|
|
|
using (var json = response.Content)
|
|
|
{
|
|
|
- var result = await _jsonSerializer.DeserializeFromStreamAsync<MovieDbSearch.ExternalIdLookupResult>(json).ConfigureAwait(false);
|
|
|
+ var result = await _jsonSerializer.DeserializeFromStreamAsync<ExternalIdLookupResult>(json).ConfigureAwait(false);
|
|
|
|
|
|
- if (result != null && result.tv_results != null)
|
|
|
+ if (result != null && result.Tv_Results != null)
|
|
|
{
|
|
|
- var tv = result.tv_results.FirstOrDefault();
|
|
|
+ var tv = result.Tv_Results.FirstOrDefault();
|
|
|
|
|
|
if (tv != null)
|
|
|
{
|
|
|
- var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
+ var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
|
|
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
|
|
|
|
|
var remoteResult = new RemoteSearchResult
|
|
|
{
|
|
|
- Name = tv.name,
|
|
|
+ Name = tv.Name,
|
|
|
SearchProviderName = Name,
|
|
|
- ImageUrl = string.IsNullOrWhiteSpace(tv.poster_path) ? null : tmdbImageUrl + tv.poster_path
|
|
|
+ ImageUrl = string.IsNullOrWhiteSpace(tv.Poster_Path) ? null : tmdbImageUrl + tv.Poster_Path
|
|
|
};
|
|
|
|
|
|
- remoteResult.SetProviderId(MetadataProviders.Tmdb, tv.id.ToString(_usCulture));
|
|
|
+ remoteResult.SetProviderId(MetadataProviders.Tmdb, tv.Id.ToString(_usCulture));
|
|
|
|
|
|
return remoteResult;
|
|
|
}
|
|
@@ -511,163 +514,6 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public class CreatedBy
|
|
|
- {
|
|
|
- public int id { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- public string profile_path { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Genre
|
|
|
- {
|
|
|
- public int id { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Network
|
|
|
- {
|
|
|
- public int id { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Season
|
|
|
- {
|
|
|
- public string air_date { get; set; }
|
|
|
- public int episode_count { get; set; }
|
|
|
- public int id { get; set; }
|
|
|
- public string poster_path { get; set; }
|
|
|
- public int season_number { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Cast
|
|
|
- {
|
|
|
- public string character { get; set; }
|
|
|
- public string credit_id { get; set; }
|
|
|
- public int id { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- public string profile_path { get; set; }
|
|
|
- public int order { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Crew
|
|
|
- {
|
|
|
- public string credit_id { get; set; }
|
|
|
- public string department { get; set; }
|
|
|
- public int id { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- public string job { get; set; }
|
|
|
- public string profile_path { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Credits
|
|
|
- {
|
|
|
- public List<Cast> cast { get; set; }
|
|
|
- public List<Crew> crew { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Backdrop
|
|
|
- {
|
|
|
- public double aspect_ratio { get; set; }
|
|
|
- public string file_path { get; set; }
|
|
|
- public int height { get; set; }
|
|
|
- public string iso_639_1 { get; set; }
|
|
|
- public double vote_average { get; set; }
|
|
|
- public int vote_count { get; set; }
|
|
|
- public int width { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Poster
|
|
|
- {
|
|
|
- public double aspect_ratio { get; set; }
|
|
|
- public string file_path { get; set; }
|
|
|
- public int height { get; set; }
|
|
|
- public string iso_639_1 { get; set; }
|
|
|
- public double vote_average { get; set; }
|
|
|
- public int vote_count { get; set; }
|
|
|
- public int width { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Images
|
|
|
- {
|
|
|
- public List<Backdrop> backdrops { get; set; }
|
|
|
- public List<Poster> posters { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Keywords
|
|
|
- {
|
|
|
- public List<object> results { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class ExternalIds
|
|
|
- {
|
|
|
- public string imdb_id { get; set; }
|
|
|
- public string freebase_id { get; set; }
|
|
|
- public string freebase_mid { get; set; }
|
|
|
- public int tvdb_id { get; set; }
|
|
|
- public int tvrage_id { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Videos
|
|
|
- {
|
|
|
- public List<Video> results { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class Video
|
|
|
- {
|
|
|
- public string id { get; set; }
|
|
|
- public string iso_639_1 { get; set; }
|
|
|
- public string iso_3166_1 { get; set; }
|
|
|
- public string key { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- public string site { get; set; }
|
|
|
- public string size { get; set; }
|
|
|
- public string type { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class ContentRating
|
|
|
- {
|
|
|
- public string iso_3166_1 { get; set; }
|
|
|
- public string rating { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class ContentRatings
|
|
|
- {
|
|
|
- public List<ContentRating> results { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- public class RootObject
|
|
|
- {
|
|
|
- public string backdrop_path { get; set; }
|
|
|
- public List<CreatedBy> created_by { get; set; }
|
|
|
- public List<int> episode_run_time { get; set; }
|
|
|
- public DateTime first_air_date { get; set; }
|
|
|
- public List<Genre> genres { get; set; }
|
|
|
- public string homepage { get; set; }
|
|
|
- public int id { get; set; }
|
|
|
- public bool in_production { get; set; }
|
|
|
- public List<string> languages { get; set; }
|
|
|
- public DateTime last_air_date { get; set; }
|
|
|
- public string name { get; set; }
|
|
|
- public List<Network> networks { get; set; }
|
|
|
- public int number_of_episodes { get; set; }
|
|
|
- public int number_of_seasons { get; set; }
|
|
|
- public string original_name { get; set; }
|
|
|
- public List<string> origin_country { get; set; }
|
|
|
- public string overview { get; set; }
|
|
|
- public string popularity { get; set; }
|
|
|
- public string poster_path { get; set; }
|
|
|
- public List<Season> seasons { get; set; }
|
|
|
- public string status { get; set; }
|
|
|
- public double vote_average { get; set; }
|
|
|
- public int vote_count { get; set; }
|
|
|
- public Credits credits { get; set; }
|
|
|
- public Images images { get; set; }
|
|
|
- public Keywords keywords { get; set; }
|
|
|
- public ExternalIds external_ids { get; set; }
|
|
|
- public Videos videos { get; set; }
|
|
|
- public ContentRatings content_ratings { get; set; }
|
|
|
- public string ResultLanguage { get; set; }
|
|
|
- }
|
|
|
// After TheTVDB
|
|
|
public int Order => 1;
|
|
|
|