Merge pull request #1808 from softworkz/TheMovieDbChanges

TheMovieDB Changes
This commit is contained in:
Luke 2016-06-04 00:47:22 -04:00
commit afe918b962
4 changed files with 60 additions and 5 deletions

View File

@ -114,6 +114,22 @@ namespace MediaBrowser.Providers.TV
item.CommunityRating = (float)response.vote_average;
item.VoteCount = response.vote_count;
if (response.videos != null && response.videos.results != null)
{
foreach (var video in response.videos.results)
{
if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|| video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase))
{
if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase))
{
var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key);
item.AddTrailerUrl(videoUrl, true);
}
}
}
}
result.ResetPeople();
var credits = response.credits;

View File

@ -210,7 +210,19 @@ namespace MediaBrowser.Providers.TV
public class Videos
{
public List<object> results { get; set; }
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 RootObject

View File

@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.TV
result.HasMetadata = true;
result.Item = new Season();
result.Item.Name = info.Name;
result.Item.Name = seasonInfo.name;
result.Item.IndexNumber = seasonNumber;
result.Item.Overview = seasonInfo.overview;

View File

@ -168,7 +168,7 @@ namespace MediaBrowser.Providers.TV
{
cancellationToken.ThrowIfCancellationRequested();
result.Item = await FetchMovieData(tmdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
result.Item = await FetchSeriesData(tmdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
result.HasMetadata = result.Item != null;
}
@ -176,7 +176,7 @@ namespace MediaBrowser.Providers.TV
return result;
}
private async Task<Series> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
private async Task<Series> FetchSeriesData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
{
string dataFilePath = null;
RootObject seriesInfo = null;
@ -285,6 +285,21 @@ namespace MediaBrowser.Providers.TV
series.OfficialRating = minimumRelease.rating;
}
if (seriesInfo.videos != null && seriesInfo.videos.results != null)
{
foreach (var video in seriesInfo.videos.results)
{
if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|| video.type.Equals("clip", System.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, true);
}
}
}
}
}
internal static string GetSeriesDataPath(IApplicationPaths appPaths, string tmdbId)
@ -555,7 +570,19 @@ namespace MediaBrowser.Providers.TV
public class Videos
{
public List<object> results { get; set; }
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