|
|
|
@ -177,13 +177,7 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
private async Task<MetadataResult<Series>> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
string dataFilePath = null;
|
|
|
|
|
RootObject seriesInfo = null;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tmdbId))
|
|
|
|
|
{
|
|
|
|
|
seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
RootObject seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
if (seriesInfo == null)
|
|
|
|
|
{
|
|
|
|
@ -192,7 +186,7 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
tmdbId = seriesInfo.id.ToString(_usCulture);
|
|
|
|
|
|
|
|
|
|
dataFilePath = GetDataFilePath(tmdbId, language);
|
|
|
|
|
string dataFilePath = GetDataFilePath(tmdbId, language);
|
|
|
|
|
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
|
|
|
|
|
_jsonSerializer.SerializeToFile(seriesInfo, dataFilePath);
|
|
|
|
|
|
|
|
|
@ -220,7 +214,7 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture);
|
|
|
|
|
|
|
|
|
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var rating))
|
|
|
|
|
if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out float rating))
|
|
|
|
|
{
|
|
|
|
|
series.CommunityRating = rating;
|
|
|
|
|
}
|
|
|
|
@ -293,14 +287,11 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
{
|
|
|
|
|
foreach (var video in seriesInfo.videos.results)
|
|
|
|
|
{
|
|
|
|
|
if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if ((video.type.Equals("trailer", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| video.type.Equals("clip", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
&& video.site.Equals("youtube", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key);
|
|
|
|
|
series.AddTrailerUrl(videoUrl);
|
|
|
|
|
}
|
|
|
|
|
series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.key}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -351,9 +342,12 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
internal async Task DownloadSeriesInfo(string id, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
var mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
RootObject mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
if (mainResult == null) return;
|
|
|
|
|
if (mainResult == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dataFilePath = GetDataFilePath(id, preferredMetadataLanguage);
|
|
|
|
|
|
|
|
|
@ -368,10 +362,8 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(language))
|
|
|
|
|
{
|
|
|
|
|
url += string.Format("&language={0}", MovieDbProvider.NormalizeLanguage(language));
|
|
|
|
|
|
|
|
|
|
// Get images in english and with no language
|
|
|
|
|
url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
|
|
|
|
url += "&language=" + MovieDbProvider.NormalizeLanguage(language)
|
|
|
|
|
+ "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
@ -405,7 +397,7 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
!string.IsNullOrEmpty(language) &&
|
|
|
|
|
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language " + language + ". Trying English...");
|
|
|
|
|
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language {Language}. Trying English...", language);
|
|
|
|
|
|
|
|
|
|
url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey) + "&language=en";
|
|
|
|
|
|
|
|
|
|