Fix style issues

This commit is contained in:
Claus Vium 2019-08-18 14:44:13 +02:00
parent 78441730a7
commit 82b0015b30
68 changed files with 532 additions and 565 deletions

View File

@ -7,12 +7,16 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
{ {
public class TmdbBoxSetExternalId : IExternalId public class TmdbBoxSetExternalId : IExternalId
{ {
/// <inheritdoc />
public string Name => TmdbUtils.ProviderName; public string Name => TmdbUtils.ProviderName;
/// <inheritdoc />
public string Key => MetadataProviders.TmdbCollection.ToString(); public string Key => MetadataProviders.TmdbCollection.ToString();
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) public bool Supports(IHasProviderIds item)
{ {
return item is Movie || item is MusicVideo || item is Trailer; return item is Movie || item is MusicVideo || item is Trailer;

View File

@ -71,16 +71,16 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
{ {
var list = new List<RemoteImageInfo>(); var list = new List<RemoteImageInfo>();
var images = obj.images ?? new CollectionImages(); var images = obj.Images ?? new CollectionImages();
list.AddRange(GetPosters(images).Select(i => new RemoteImageInfo list.AddRange(GetPosters(images).Select(i => new RemoteImageInfo
{ {
Url = baseUrl + i.file_path, Url = baseUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language),
ProviderName = Name, ProviderName = Name,
Type = ImageType.Primary, Type = ImageType.Primary,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -88,11 +88,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
list.AddRange(GetBackdrops(images).Select(i => new RemoteImageInfo list.AddRange(GetBackdrops(images).Select(i => new RemoteImageInfo
{ {
Url = baseUrl + i.file_path, Url = baseUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
ProviderName = Name, ProviderName = Name,
Type = ImageType.Backdrop, Type = ImageType.Backdrop,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -130,7 +130,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
/// <returns>IEnumerable{MovieDbProvider.Poster}.</returns> /// <returns>IEnumerable{MovieDbProvider.Poster}.</returns>
private IEnumerable<Poster> GetPosters(CollectionImages images) private IEnumerable<Poster> GetPosters(CollectionImages images)
{ {
return images.posters ?? new List<Poster>(); return images.Posters ?? new List<Poster>();
} }
/// <summary> /// <summary>
@ -140,11 +140,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
/// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns> /// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns>
private IEnumerable<Backdrop> GetBackdrops(CollectionImages images) private IEnumerable<Backdrop> GetBackdrops(CollectionImages images)
{ {
var eligibleBackdrops = images.backdrops == null ? new List<Backdrop>() : var eligibleBackdrops = images.Backdrops == null ? new List<Backdrop>() :
images.backdrops; images.Backdrops;
return eligibleBackdrops.OrderByDescending(i => i.vote_average) return eligibleBackdrops.OrderByDescending(i => i.Vote_Average)
.ThenByDescending(i => i.vote_count); .ThenByDescending(i => i.Vote_Count);
} }
public int Order => 0; public int Order => 0;

View File

@ -62,7 +62,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, searchInfo.MetadataLanguage); var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, searchInfo.MetadataLanguage);
var info = _json.DeserializeFromFile<CollectionResult>(dataFilePath); var info = _json.DeserializeFromFile<CollectionResult>(dataFilePath);
var images = (info.images ?? new CollectionImages()).posters ?? new List<Poster>(); var images = (info.Images ?? new CollectionImages()).Posters ?? new List<Poster>();
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
@ -70,14 +70,14 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
var result = new RemoteSearchResult var result = new RemoteSearchResult
{ {
Name = info.name, Name = info.Name,
SearchProviderName = Name, SearchProviderName = Name,
ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].file_path) ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].File_Path)
}; };
result.SetProviderId(MetadataProviders.Tmdb, info.id.ToString(_usCulture)); result.SetProviderId(MetadataProviders.Tmdb, info.Id.ToString(_usCulture));
return new[] { result }; return new[] { result };
} }
@ -141,11 +141,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
{ {
var item = new BoxSet var item = new BoxSet
{ {
Name = obj.name, Name = obj.Name,
Overview = obj.overview Overview = obj.Overview
}; };
item.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture)); item.SetProviderId(MetadataProviders.Tmdb, obj.Id.ToString(_usCulture));
return item; return item;
} }
@ -195,7 +195,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
if (mainResult != null && string.IsNullOrEmpty(mainResult.name)) if (mainResult != null && string.IsNullOrEmpty(mainResult.Name))
{ {
if (!string.IsNullOrEmpty(language) && !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) if (!string.IsNullOrEmpty(language) && !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
{ {

View File

@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections
{ {
public class CollectionImages public class CollectionImages
{ {
public List<Backdrop> backdrops { get; set; } public List<Backdrop> Backdrops { get; set; }
public List<Poster> posters { get; set; } public List<Poster> Posters { get; set; }
} }
} }

View File

@ -4,12 +4,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections
{ {
public class CollectionResult public class CollectionResult
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
public List<Part> parts { get; set; } public List<Part> Parts { get; set; }
public CollectionImages images { get; set; } public CollectionImages Images { get; set; }
} }
} }

View File

@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections
{ {
public class Part public class Part
{ {
public string title { get; set; } public string Title { get; set; }
public int id { get; set; } public int Id { get; set; }
public string release_date { get; set; } public string Release_Date { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
} }
} }

View File

@ -2,12 +2,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Backdrop public class Backdrop
{ {
public double aspect_ratio { get; set; } public double Aspect_Ratio { get; set; }
public string file_path { get; set; } public string File_Path { get; set; }
public int height { get; set; } public int Height { get; set; }
public string iso_639_1 { get; set; } public string Iso_639_1 { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public int width { get; set; } public int Width { get; set; }
} }
} }

View File

@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Crew public class Crew
{ {
public int id { get; set; } public int Id { get; set; }
public string credit_id { get; set; } public string Credit_Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string department { get; set; } public string Department { get; set; }
public string job { get; set; } public string Job { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
} }
} }

View File

@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class ExternalIds public class ExternalIds
{ {
public string imdb_id { get; set; } public string Imdb_Id { get; set; }
public object freebase_id { get; set; } public object Freebase_Id { get; set; }
public string freebase_mid { get; set; } public string Freebase_Mid { get; set; }
public int tvdb_id { get; set; } public int Tvdb_Id { get; set; }
public int tvrage_id { get; set; } public int Tvrage_Id { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Genre public class Genre
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
} }
} }

View File

@ -4,7 +4,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Images public class Images
{ {
public List<Backdrop> backdrops { get; set; } public List<Backdrop> Backdrops { get; set; }
public List<Poster> posters { get; set; } public List<Poster> Posters { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Keyword public class Keyword
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Keywords public class Keywords
{ {
public List<Keyword> results { get; set; } public List<Keyword> Results { get; set; }
} }
} }

View File

@ -2,12 +2,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Poster public class Poster
{ {
public double aspect_ratio { get; set; } public double Aspect_Ratio { get; set; }
public string file_path { get; set; } public string File_Path { get; set; }
public int height { get; set; } public int Height { get; set; }
public string iso_639_1 { get; set; } public string Iso_639_1 { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public int width { get; set; } public int Width { get; set; }
} }
} }

View File

@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Profile public class Profile
{ {
public string file_path { get; set; } public string File_Path { get; set; }
public int width { get; set; } public int Width { get; set; }
public int height { get; set; } public int Height { get; set; }
public object iso_639_1 { get; set; } public object Iso_639_1 { get; set; }
public double aspect_ratio { get; set; } public double Aspect_Ratio { get; set; }
} }
} }

View File

@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Still public class Still
{ {
public double aspect_ratio { get; set; } public double Aspect_Ratio { get; set; }
public string file_path { get; set; } public string File_Path { get; set; }
public int height { get; set; } public int Height { get; set; }
public string id { get; set; } public string Id { get; set; }
public string iso_639_1 { get; set; } public string Iso_639_1 { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public int width { get; set; } public int Width { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class StillImages public class StillImages
{ {
public List<Still> stills { get; set; } public List<Still> Stills { get; set; }
} }
} }

View File

@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Video public class Video
{ {
public string id { get; set; } public string Id { get; set; }
public string iso_639_1 { get; set; } public string Iso_639_1 { get; set; }
public string iso_3166_1 { get; set; } public string Iso_3166_1 { get; set; }
public string key { get; set; } public string Key { get; set; }
public string name { get; set; } public string Name { get; set; }
public string site { get; set; } public string Site { get; set; }
public string size { get; set; } public string Size { get; set; }
public string type { get; set; } public string Type { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General
{ {
public class Videos public class Videos
{ {
public List<Video> results { get; set; } public List<Video> Results { get; set; }
} }
} }

View File

@ -2,9 +2,9 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class BelongsToCollection public class BelongsToCollection
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
} }
} }

View File

@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Cast public class Cast
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string character { get; set; } public string Character { get; set; }
public int order { get; set; } public int Order { get; set; }
public int cast_id { get; set; } public int Cast_Id { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
} }
} }

View File

@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Casts public class Casts
{ {
public List<Cast> cast { get; set; } public List<Cast> Cast { get; set; }
public List<Crew> crew { get; set; } public List<Crew> Crew { get; set; }
} }
} }

View File

@ -4,8 +4,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Country public class Country
{ {
public string iso_3166_1 { get; set; } public string Iso_3166_1 { get; set; }
public string certification { get; set; } public string Certification { get; set; }
public DateTime release_date { get; set; } public DateTime Release_Date { get; set; }
} }
} }

View File

@ -5,45 +5,45 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class MovieResult public class MovieResult
{ {
public bool adult { get; set; } public bool Adult { get; set; }
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
public BelongsToCollection belongs_to_collection { get; set; } public BelongsToCollection Belongs_To_Collection { get; set; }
public int budget { get; set; } public int Budget { get; set; }
public List<Genre> genres { get; set; } public List<Genre> Genres { get; set; }
public string homepage { get; set; } public string Homepage { get; set; }
public int id { get; set; } public int Id { get; set; }
public string imdb_id { get; set; } public string Imdb_Id { get; set; }
public string original_title { get; set; } public string Original_Title { get; set; }
public string original_name { get; set; } public string Original_Name { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public double popularity { get; set; } public double Popularity { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public List<ProductionCompany> production_companies { get; set; } public List<ProductionCompany> Production_Companies { get; set; }
public List<ProductionCountry> production_countries { get; set; } public List<ProductionCountry> Production_Countries { get; set; }
public string release_date { get; set; } public string Release_Date { get; set; }
public int revenue { get; set; } public int Revenue { get; set; }
public int runtime { get; set; } public int Runtime { get; set; }
public List<SpokenLanguage> spoken_languages { get; set; } public List<SpokenLanguage> Spoken_Languages { get; set; }
public string status { get; set; } public string Status { get; set; }
public string tagline { get; set; } public string Tagline { get; set; }
public string title { get; set; } public string Title { get; set; }
public string name { get; set; } public string Name { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public Casts casts { get; set; } public Casts Casts { get; set; }
public Releases releases { get; set; } public Releases Releases { get; set; }
public Images images { get; set; } public Images Images { get; set; }
public Keywords keywords { get; set; } public Keywords Keywords { get; set; }
public Trailers trailers { get; set; } public Trailers Trailers { get; set; }
public string GetOriginalTitle() public string GetOriginalTitle()
{ {
return original_name ?? original_title; return Original_Name ?? Original_Title;
} }
public string GetTitle() public string GetTitle()
{ {
return name ?? title ?? GetOriginalTitle(); return Name ?? Title ?? GetOriginalTitle();
} }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class ProductionCompany public class ProductionCompany
{ {
public string name { get; set; } public string Name { get; set; }
public int id { get; set; } public int Id { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class ProductionCountry public class ProductionCountry
{ {
public string iso_3166_1 { get; set; } public string Iso_3166_1 { get; set; }
public string name { get; set; } public string Name { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Releases public class Releases
{ {
public List<Country> countries { get; set; } public List<Country> Countries { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class SpokenLanguage public class SpokenLanguage
{ {
public string iso_639_1 { get; set; } public string Iso_639_1 { get; set; }
public string name { get; set; } public string Name { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Trailers public class Trailers
{ {
public List<Youtube> youtube { get; set; } public List<Youtube> Youtube { get; set; }
} }
} }

View File

@ -2,8 +2,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.Movies
{ {
public class Youtube public class Youtube
{ {
public string name { get; set; } public string Name { get; set; }
public string size { get; set; } public string Size { get; set; }
public string source { get; set; } public string Source { get; set; }
} }
} }

View File

@ -5,6 +5,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.People
{ {
public class PersonImages public class PersonImages
{ {
public List<Profile> profiles { get; set; } public List<Profile> Profiles { get; set; }
} }
} }

View File

@ -5,19 +5,19 @@ namespace MediaBrowser.Providers.Tmdb.Models.People
{ {
public class PersonResult public class PersonResult
{ {
public bool adult { get; set; } public bool Adult { get; set; }
public List<string> also_known_as { get; set; } public List<string> Also_Known_As { get; set; }
public string biography { get; set; } public string Biography { get; set; }
public string birthday { get; set; } public string Birthday { get; set; }
public string deathday { get; set; } public string Deathday { get; set; }
public string homepage { get; set; } public string Homepage { get; set; }
public int id { get; set; } public int Id { get; set; }
public string imdb_id { get; set; } public string Imdb_Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string place_of_birth { get; set; } public string Place_Of_Birth { get; set; }
public double popularity { get; set; } public double Popularity { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
public PersonImages images { get; set; } public PersonImages Images { get; set; }
public ExternalIds external_ids { get; set; } public ExternalIds External_Ids { get; set; }
} }
} }

View File

@ -1,28 +0,0 @@
using System.Collections.Generic;
namespace MediaBrowser.Providers.Tmdb.Models.People
{
public class PersonSearchResults
{
/// <summary>
/// Gets or sets the page.
/// </summary>
/// <value>The page.</value>
public int Page { get; set; }
/// <summary>
/// Gets or sets the results.
/// </summary>
/// <value>The results.</value>
public List<PersonSearchResult> Results { get; set; }
/// <summary>
/// Gets or sets the total_ pages.
/// </summary>
/// <value>The total_ pages.</value>
public int Total_Pages { get; set; }
/// <summary>
/// Gets or sets the total_ results.
/// </summary>
/// <value>The total_ results.</value>
public int Total_Results { get; set; }
}
}

View File

@ -5,6 +5,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.Search
{ {
public class ExternalIdLookupResult public class ExternalIdLookupResult
{ {
public List<TvResult> tv_results { get; set; } public List<TvResult> Tv_Results { get; set; }
} }
} }

View File

@ -6,60 +6,60 @@ namespace MediaBrowser.Providers.Tmdb.Models.Search
/// Gets or sets a value indicating whether this <see cref="TmdbMovieSearchResult" /> is adult. /// Gets or sets a value indicating whether this <see cref="TmdbMovieSearchResult" /> is adult.
/// </summary> /// </summary>
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value> /// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
public bool adult { get; set; } public bool Adult { get; set; }
/// <summary> /// <summary>
/// Gets or sets the backdrop_path. /// Gets or sets the backdrop_path.
/// </summary> /// </summary>
/// <value>The backdrop_path.</value> /// <value>The backdrop_path.</value>
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
public int id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the original_title. /// Gets or sets the original_title.
/// </summary> /// </summary>
/// <value>The original_title.</value> /// <value>The original_title.</value>
public string original_title { get; set; } public string Original_Title { get; set; }
/// <summary> /// <summary>
/// Gets or sets the original_name. /// Gets or sets the original_name.
/// </summary> /// </summary>
/// <value>The original_name.</value> /// <value>The original_name.</value>
public string original_name { get; set; } public string Original_Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the release_date. /// Gets or sets the release_date.
/// </summary> /// </summary>
/// <value>The release_date.</value> /// <value>The release_date.</value>
public string release_date { get; set; } public string Release_Date { get; set; }
/// <summary> /// <summary>
/// Gets or sets the poster_path. /// Gets or sets the poster_path.
/// </summary> /// </summary>
/// <value>The poster_path.</value> /// <value>The poster_path.</value>
public string poster_path { get; set; } public string Poster_Path { get; set; }
/// <summary> /// <summary>
/// Gets or sets the popularity. /// Gets or sets the popularity.
/// </summary> /// </summary>
/// <value>The popularity.</value> /// <value>The popularity.</value>
public double popularity { get; set; } public double Popularity { get; set; }
/// <summary> /// <summary>
/// Gets or sets the title. /// Gets or sets the title.
/// </summary> /// </summary>
/// <value>The title.</value> /// <value>The title.</value>
public string title { get; set; } public string Title { get; set; }
/// <summary> /// <summary>
/// Gets or sets the vote_average. /// Gets or sets the vote_average.
/// </summary> /// </summary>
/// <value>The vote_average.</value> /// <value>The vote_average.</value>
public double vote_average { get; set; } public double Vote_Average { get; set; }
/// <summary> /// <summary>
/// For collection search results /// For collection search results
/// </summary> /// </summary>
public string name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the vote_count. /// Gets or sets the vote_count.
/// </summary> /// </summary>
/// <value>The vote_count.</value> /// <value>The vote_count.</value>
public int vote_count { get; set; } public int Vote_Count { get; set; }
} }
} }

View File

@ -1,28 +0,0 @@
using System.Collections.Generic;
namespace MediaBrowser.Providers.Tmdb.Models.Search
{
public class MovieSearchResults
{
/// <summary>
/// Gets or sets the page.
/// </summary>
/// <value>The page.</value>
public int page { get; set; }
/// <summary>
/// Gets or sets the results.
/// </summary>
/// <value>The results.</value>
public List<MovieResult> results { get; set; }
/// <summary>
/// Gets or sets the total_pages.
/// </summary>
/// <value>The total_pages.</value>
public int total_pages { get; set; }
/// <summary>
/// Gets or sets the total_results.
/// </summary>
/// <value>The total_results.</value>
public int total_results { get; set; }
}
}

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Providers.Tmdb.Models.People namespace MediaBrowser.Providers.Tmdb.Models.Search
{ {
public class PersonSearchResult public class PersonSearchResult
{ {
@ -7,16 +7,19 @@ namespace MediaBrowser.Providers.Tmdb.Models.People
/// </summary> /// </summary>
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value> /// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
public bool Adult { get; set; } public bool Adult { get; set; }
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
/// </summary> /// </summary>
/// <value>The id.</value> /// <value>The id.</value>
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the profile_ path. /// Gets or sets the profile_ path.
/// </summary> /// </summary>

View File

@ -2,27 +2,30 @@ using System.Collections.Generic;
namespace MediaBrowser.Providers.Tmdb.Models.Search namespace MediaBrowser.Providers.Tmdb.Models.Search
{ {
public class TvSearchResults public class TmdbSearchResult<T>
{ {
/// <summary> /// <summary>
/// Gets or sets the page. /// Gets or sets the page.
/// </summary> /// </summary>
/// <value>The page.</value> /// <value>The page.</value>
public int page { get; set; } public int Page { get; set; }
/// <summary> /// <summary>
/// Gets or sets the results. /// Gets or sets the results.
/// </summary> /// </summary>
/// <value>The results.</value> /// <value>The results.</value>
public List<TvResult> results { get; set; } public List<T> Results { get; set; }
/// <summary> /// <summary>
/// Gets or sets the total_pages. /// Gets or sets the total_pages.
/// </summary> /// </summary>
/// <value>The total_pages.</value> /// <value>The total_pages.</value>
public int total_pages { get; set; } public int Total_Pages { get; set; }
/// <summary> /// <summary>
/// Gets or sets the total_results. /// Gets or sets the total_results.
/// </summary> /// </summary>
/// <value>The total_results.</value> /// <value>The total_results.</value>
public int total_results { get; set; } public int Total_Results { get; set; }
} }
} }

View File

@ -2,14 +2,14 @@ namespace MediaBrowser.Providers.Tmdb.Models.Search
{ {
public class TvResult public class TvResult
{ {
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
public string first_air_date { get; set; } public string First_Air_Date { get; set; }
public int id { get; set; } public int Id { get; set; }
public string original_name { get; set; } public string Original_Name { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public double popularity { get; set; } public double Popularity { get; set; }
public string name { get; set; } public string Name { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
} }
} }

View File

@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class Cast public class Cast
{ {
public string character { get; set; } public string Character { get; set; }
public string credit_id { get; set; } public string Credit_Id { get; set; }
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
public int order { get; set; } public int Order { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class ContentRating public class ContentRating
{ {
public string iso_3166_1 { get; set; } public string Iso_3166_1 { get; set; }
public string rating { get; set; } public string Rating { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class ContentRatings public class ContentRatings
{ {
public List<ContentRating> results { get; set; } public List<ContentRating> Results { get; set; }
} }
} }

View File

@ -2,8 +2,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class CreatedBy public class CreatedBy
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
} }
} }

View File

@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class Credits public class Credits
{ {
public List<Cast> cast { get; set; } public List<Cast> Cast { get; set; }
public List<Crew> crew { get; set; } public List<Crew> Crew { get; set; }
} }
} }

View File

@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class Episode public class Episode
{ {
public string air_date { get; set; } public string Air_Date { get; set; }
public int episode_number { get; set; } public int Episode_Number { get; set; }
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public string still_path { get; set; } public string Still_Path { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
} }
} }

View File

@ -5,8 +5,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class EpisodeCredits public class EpisodeCredits
{ {
public List<Cast> cast { get; set; } public List<Cast> Cast { get; set; }
public List<Crew> crew { get; set; } public List<Crew> Crew { get; set; }
public List<GuestStar> guest_stars { get; set; } public List<GuestStar> Guest_Stars { get; set; }
} }
} }

View File

@ -5,19 +5,19 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class EpisodeResult public class EpisodeResult
{ {
public DateTime air_date { get; set; } public DateTime Air_Date { get; set; }
public int episode_number { get; set; } public int Episode_Number { get; set; }
public string name { get; set; } public string Name { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public int id { get; set; } public int Id { get; set; }
public object production_code { get; set; } public object Production_Code { get; set; }
public int season_number { get; set; } public int Season_Number { get; set; }
public string still_path { get; set; } public string Still_Path { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public StillImages images { get; set; } public StillImages Images { get; set; }
public ExternalIds external_ids { get; set; } public ExternalIds External_Ids { get; set; }
public EpisodeCredits credits { get; set; } public EpisodeCredits Credits { get; set; }
public Tmdb.Models.General.Videos videos { get; set; } public Tmdb.Models.General.Videos Videos { get; set; }
} }
} }

View File

@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class GuestStar public class GuestStar
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
public string credit_id { get; set; } public string Credit_Id { get; set; }
public string character { get; set; } public string Character { get; set; }
public int order { get; set; } public int Order { get; set; }
public string profile_path { get; set; } public string Profile_Path { get; set; }
} }
} }

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class Network public class Network
{ {
public int id { get; set; } public int Id { get; set; }
public string name { get; set; } public string Name { get; set; }
} }
} }

View File

@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class Season public class Season
{ {
public string air_date { get; set; } public string Air_Date { get; set; }
public int episode_count { get; set; } public int Episode_Count { get; set; }
public int id { get; set; } public int Id { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public int season_number { get; set; } public int Season_Number { get; set; }
} }
} }

View File

@ -5,6 +5,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class SeasonImages public class SeasonImages
{ {
public List<Poster> posters { get; set; } public List<Poster> Posters { get; set; }
} }
} }

View File

@ -6,16 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class SeasonResult public class SeasonResult
{ {
public DateTime air_date { get; set; } public DateTime Air_Date { get; set; }
public List<Episode> episodes { get; set; } public List<Episode> Episodes { get; set; }
public string name { get; set; } public string Name { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public int id { get; set; } public int Id { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public int season_number { get; set; } public int Season_Number { get; set; }
public Credits credits { get; set; } public Credits Credits { get; set; }
public SeasonImages images { get; set; } public SeasonImages Images { get; set; }
public ExternalIds external_ids { get; set; } public ExternalIds External_Ids { get; set; }
public General.Videos videos { get; set; } public General.Videos Videos { get; set; }
} }
} }

View File

@ -6,35 +6,35 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV
{ {
public class SeriesResult public class SeriesResult
{ {
public string backdrop_path { get; set; } public string Backdrop_Path { get; set; }
public List<CreatedBy> created_by { get; set; } public List<CreatedBy> Created_By { get; set; }
public List<int> episode_run_time { get; set; } public List<int> Episode_Run_Time { get; set; }
public DateTime first_air_date { get; set; } public DateTime First_Air_Date { get; set; }
public List<Genre> genres { get; set; } public List<Genre> Genres { get; set; }
public string homepage { get; set; } public string Homepage { get; set; }
public int id { get; set; } public int Id { get; set; }
public bool in_production { get; set; } public bool In_Production { get; set; }
public List<string> languages { get; set; } public List<string> Languages { get; set; }
public DateTime last_air_date { get; set; } public DateTime Last_Air_Date { get; set; }
public string name { get; set; } public string Name { get; set; }
public List<Network> networks { get; set; } public List<Network> Networks { get; set; }
public int number_of_episodes { get; set; } public int Number_Of_Episodes { get; set; }
public int number_of_seasons { get; set; } public int Number_Of_Seasons { get; set; }
public string original_name { get; set; } public string Original_Name { get; set; }
public List<string> origin_country { get; set; } public List<string> Origin_Country { get; set; }
public string overview { get; set; } public string Overview { get; set; }
public string popularity { get; set; } public string Popularity { get; set; }
public string poster_path { get; set; } public string Poster_Path { get; set; }
public List<Season> seasons { get; set; } public List<Season> Seasons { get; set; }
public string status { get; set; } public string Status { get; set; }
public double vote_average { get; set; } public double Vote_Average { get; set; }
public int vote_count { get; set; } public int Vote_Count { get; set; }
public Credits credits { get; set; } public Credits Credits { get; set; }
public Images images { get; set; } public Images Images { get; set; }
public Keywords keywords { get; set; } public Keywords Keywords { get; set; }
public ExternalIds external_ids { get; set; } public ExternalIds External_Ids { get; set; }
public General.Videos videos { get; set; } public General.Videos Videos { get; set; }
public ContentRatings content_ratings { get; set; } public ContentRatings Content_Ratings { get; set; }
public string ResultLanguage { get; set; } public string ResultLanguage { get; set; }
} }
} }

View File

@ -91,7 +91,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false); movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
if (movieInfo != null) if (movieInfo != null)
{ {
tmdbId = movieInfo.id.ToString(_usCulture); tmdbId = movieInfo.Id.ToString(_usCulture);
dataFilePath = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language); dataFilePath = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language);
Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
@ -130,39 +130,39 @@ namespace MediaBrowser.Providers.Tmdb.Movies
movie.OriginalTitle = movieData.GetOriginalTitle(); movie.OriginalTitle = movieData.GetOriginalTitle();
movie.Overview = string.IsNullOrWhiteSpace(movieData.overview) ? null : WebUtility.HtmlDecode(movieData.overview); movie.Overview = string.IsNullOrWhiteSpace(movieData.Overview) ? null : WebUtility.HtmlDecode(movieData.Overview);
movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null; movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null;
//movie.HomePageUrl = movieData.homepage; //movie.HomePageUrl = movieData.homepage;
if (!string.IsNullOrEmpty(movieData.tagline)) if (!string.IsNullOrEmpty(movieData.Tagline))
{ {
movie.Tagline = movieData.tagline; movie.Tagline = movieData.Tagline;
} }
if (movieData.production_countries != null) if (movieData.Production_Countries != null)
{ {
movie.ProductionLocations = movieData movie.ProductionLocations = movieData
.production_countries .Production_Countries
.Select(i => i.name) .Select(i => i.Name)
.ToArray(); .ToArray();
} }
movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture)); movie.SetProviderId(MetadataProviders.Tmdb, movieData.Id.ToString(_usCulture));
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id); movie.SetProviderId(MetadataProviders.Imdb, movieData.Imdb_Id);
if (movieData.belongs_to_collection != null) if (movieData.Belongs_To_Collection != null)
{ {
movie.SetProviderId(MetadataProviders.TmdbCollection, movie.SetProviderId(MetadataProviders.TmdbCollection,
movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture)); movieData.Belongs_To_Collection.Id.ToString(CultureInfo.InvariantCulture));
if (movie is Movie movieItem) if (movie is Movie movieItem)
{ {
movieItem.CollectionName = movieData.belongs_to_collection.name; movieItem.CollectionName = movieData.Belongs_To_Collection.Name;
} }
} }
string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture); string voteAvg = movieData.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 var rating))
{ {
@ -171,17 +171,17 @@ namespace MediaBrowser.Providers.Tmdb.Movies
//movie.VoteCount = movieData.vote_count; //movie.VoteCount = movieData.vote_count;
if (movieData.releases != null && movieData.releases.countries != null) if (movieData.Releases != null && movieData.Releases.Countries != null)
{ {
var releases = movieData.releases.countries.Where(i => !string.IsNullOrWhiteSpace(i.certification)).ToList(); var releases = movieData.Releases.Countries.Where(i => !string.IsNullOrWhiteSpace(i.Certification)).ToList();
var ourRelease = releases.FirstOrDefault(c => string.Equals(c.iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase)); var ourRelease = releases.FirstOrDefault(c => string.Equals(c.Iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase));
var usRelease = releases.FirstOrDefault(c => string.Equals(c.iso_3166_1, "US", StringComparison.OrdinalIgnoreCase)); var usRelease = releases.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));
if (ourRelease != null) if (ourRelease != null)
{ {
var ratingPrefix = string.Equals(preferredCountryCode, "us", StringComparison.OrdinalIgnoreCase) ? "" : preferredCountryCode + "-"; var ratingPrefix = string.Equals(preferredCountryCode, "us", StringComparison.OrdinalIgnoreCase) ? "" : preferredCountryCode + "-";
var newRating = ratingPrefix + ourRelease.certification; var newRating = ratingPrefix + ourRelease.Certification;
newRating = newRating.Replace("de-", "FSK-", StringComparison.OrdinalIgnoreCase); newRating = newRating.Replace("de-", "FSK-", StringComparison.OrdinalIgnoreCase);
@ -189,14 +189,14 @@ namespace MediaBrowser.Providers.Tmdb.Movies
} }
else if (usRelease != null) else if (usRelease != null)
{ {
movie.OfficialRating = usRelease.certification; movie.OfficialRating = usRelease.Certification;
} }
} }
if (!string.IsNullOrWhiteSpace(movieData.release_date)) if (!string.IsNullOrWhiteSpace(movieData.Release_Date))
{ {
// These dates are always in this exact format // These dates are always in this exact format
if (DateTime.TryParse(movieData.release_date, _usCulture, DateTimeStyles.None, out var r)) if (DateTime.TryParse(movieData.Release_Date, _usCulture, DateTimeStyles.None, out var r))
{ {
movie.PremiereDate = r.ToUniversalTime(); movie.PremiereDate = r.ToUniversalTime();
movie.ProductionYear = movie.PremiereDate.Value.Year; movie.ProductionYear = movie.PremiereDate.Value.Year;
@ -204,16 +204,16 @@ namespace MediaBrowser.Providers.Tmdb.Movies
} }
//studios //studios
if (movieData.production_companies != null) if (movieData.Production_Companies != null)
{ {
movie.SetStudios(movieData.production_companies.Select(c => c.name)); movie.SetStudios(movieData.Production_Companies.Select(c => c.Name));
} }
// genres // genres
// Movies get this from imdb // Movies get this from imdb
var genres = movieData.genres ?? new List<Tmdb.Models.General.Genre>(); var genres = movieData.Genres ?? new List<Tmdb.Models.General.Genre>();
foreach (var genre in genres.Select(g => g.name)) foreach (var genre in genres.Select(g => g.Name))
{ {
movie.AddGenre(genre); movie.AddGenre(genre);
} }
@ -223,26 +223,26 @@ namespace MediaBrowser.Providers.Tmdb.Movies
//Actors, Directors, Writers - all in People //Actors, Directors, Writers - all in People
//actors come from cast //actors come from cast
if (movieData.casts != null && movieData.casts.cast != null) if (movieData.Casts != null && movieData.Casts.Cast != null)
{ {
foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) foreach (var actor in movieData.Casts.Cast.OrderBy(a => a.Order))
{ {
var personInfo = new PersonInfo var personInfo = new PersonInfo
{ {
Name = actor.name.Trim(), Name = actor.Name.Trim(),
Role = actor.character, Role = actor.Character,
Type = PersonType.Actor, 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));
} }
resultItem.AddPerson(personInfo); resultItem.AddPerson(personInfo);
@ -250,7 +250,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
} }
//and the rest from crew //and the rest from crew
if (movieData.casts?.crew != null) if (movieData.Casts?.Crew != null)
{ {
var keepTypes = new[] var keepTypes = new[]
{ {
@ -259,32 +259,32 @@ namespace MediaBrowser.Providers.Tmdb.Movies
PersonType.Producer PersonType.Producer
}; };
foreach (var person in movieData.casts.crew) foreach (var person in movieData.Casts.Crew)
{ {
// Normalize this // Normalize this
var type = TmdbUtils.MapCrewToPersonType(person); var type = TmdbUtils.MapCrewToPersonType(person);
if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) && if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) &&
!keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) !keepTypes.Contains(person.Job ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{ {
continue; continue;
} }
var personInfo = new PersonInfo var personInfo = new PersonInfo
{ {
Name = person.name.Trim(), Name = person.Name.Trim(),
Role = person.job, Role = person.Job,
Type = type Type = type
}; };
if (!string.IsNullOrWhiteSpace(person.profile_path)) if (!string.IsNullOrWhiteSpace(person.Profile_Path))
{ {
personInfo.ImageUrl = tmdbImageUrl + person.profile_path; personInfo.ImageUrl = tmdbImageUrl + person.Profile_Path;
} }
if (person.id > 0) if (person.Id > 0)
{ {
personInfo.SetProviderId(MetadataProviders.Tmdb, person.id.ToString(CultureInfo.InvariantCulture)); personInfo.SetProviderId(MetadataProviders.Tmdb, person.Id.ToString(CultureInfo.InvariantCulture));
} }
resultItem.AddPerson(personInfo); resultItem.AddPerson(personInfo);
@ -296,12 +296,12 @@ namespace MediaBrowser.Providers.Tmdb.Movies
// movie.Keywords = movieData.keywords.keywords.Select(i => i.name).ToList(); // movie.Keywords = movieData.keywords.keywords.Select(i => i.name).ToList();
//} //}
if (movieData.trailers != null && movieData.trailers.youtube != null) if (movieData.Trailers != null && movieData.Trailers.Youtube != null)
{ {
movie.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl movie.RemoteTrailers = movieData.Trailers.Youtube.Select(i => new MediaUrl
{ {
Url = string.Format("https://www.youtube.com/watch?v={0}", i.source), Url = string.Format("https://www.youtube.com/watch?v={0}", i.Source),
Name = i.name Name = i.Name
}).ToArray(); }).ToArray();
} }

View File

@ -73,12 +73,12 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
{ {
Url = tmdbImageUrl + i.file_path, Url = tmdbImageUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language),
ProviderName = Name, ProviderName = Name,
Type = ImageType.Primary, Type = ImageType.Primary,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -89,11 +89,11 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo
{ {
Url = tmdbImageUrl + i.file_path, Url = tmdbImageUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
ProviderName = Name, ProviderName = Name,
Type = ImageType.Backdrop, Type = ImageType.Backdrop,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -132,7 +132,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
/// <returns>IEnumerable{MovieDbProvider.Poster}.</returns> /// <returns>IEnumerable{MovieDbProvider.Poster}.</returns>
private IEnumerable<Poster> GetPosters(Images images) private IEnumerable<Poster> GetPosters(Images images)
{ {
return images.posters ?? new List<Poster>(); return images.Posters ?? new List<Poster>();
} }
/// <summary> /// <summary>
@ -142,11 +142,11 @@ namespace MediaBrowser.Providers.Tmdb.Movies
/// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns> /// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns>
private IEnumerable<Backdrop> GetBackdrops(Images images) private IEnumerable<Backdrop> GetBackdrops(Images images)
{ {
var eligibleBackdrops = images.backdrops == null ? new List<Backdrop>() : var eligibleBackdrops = images.Backdrops == null ? new List<Backdrop>() :
images.backdrops; images.Backdrops;
return eligibleBackdrops.OrderByDescending(i => i.vote_average) return eligibleBackdrops.OrderByDescending(i => i.Vote_Average)
.ThenByDescending(i => i.vote_count); .ThenByDescending(i => i.Vote_Count);
} }
/// <summary> /// <summary>
@ -169,7 +169,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
var movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false); var movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
if (movieInfo != null) if (movieInfo != null)
{ {
tmdbId = movieInfo.id.ToString(CultureInfo.InvariantCulture); tmdbId = movieInfo.Id.ToString(CultureInfo.InvariantCulture);
} }
} }
} }
@ -189,7 +189,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
if (fileInfo.Exists) if (fileInfo.Exists)
{ {
return jsonSerializer.DeserializeFromFile<MovieResult>(path).images; return jsonSerializer.DeserializeFromFile<MovieResult>(path).Images;
} }
} }

View File

@ -8,12 +8,16 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
public class TmdbMovieExternalId : IExternalId public class TmdbMovieExternalId : IExternalId
{ {
/// <inheritdoc />
public string Name => TmdbUtils.ProviderName; public string Name => TmdbUtils.ProviderName;
/// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) public bool Supports(IHasProviderIds item)
{ {
// Supports images for tv movies // Supports images for tv movies

View File

@ -83,24 +83,24 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
Name = obj.GetTitle(), Name = obj.GetTitle(),
SearchProviderName = 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
}; };
if (!string.IsNullOrWhiteSpace(obj.release_date)) if (!string.IsNullOrWhiteSpace(obj.Release_Date))
{ {
// These dates are always in this exact format // These dates are always in this exact format
if (DateTime.TryParse(obj.release_date, _usCulture, DateTimeStyles.None, out var r)) if (DateTime.TryParse(obj.Release_Date, _usCulture, DateTimeStyles.None, out var r))
{ {
remoteResult.PremiereDate = r.ToUniversalTime(); remoteResult.PremiereDate = r.ToUniversalTime();
remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year; remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year;
} }
} }
remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture)); remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.Id.ToString(_usCulture));
if (!string.IsNullOrWhiteSpace(obj.imdb_id)) if (!string.IsNullOrWhiteSpace(obj.Imdb_Id))
{ {
remoteResult.SetProviderId(MetadataProviders.Imdb, obj.imdb_id); remoteResult.SetProviderId(MetadataProviders.Imdb, obj.Imdb_Id);
} }
return new[] { remoteResult }; return new[] { remoteResult };
@ -364,7 +364,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
// If the language preference isn't english, then have the overview fallback to english if it's blank // If the language preference isn't english, then have the overview fallback to english if it's blank
if (mainResult != null && if (mainResult != null &&
string.IsNullOrEmpty(mainResult.overview) && string.IsNullOrEmpty(mainResult.Overview) &&
!string.IsNullOrEmpty(language) && !string.IsNullOrEmpty(language) &&
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
{ {
@ -392,7 +392,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<MovieResult>(json).ConfigureAwait(false); var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<MovieResult>(json).ConfigureAwait(false);
mainResult.overview = englishResult.overview; mainResult.Overview = englishResult.Overview;
} }
} }
} }

View File

@ -162,9 +162,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
using (var json = response.Content) using (var json = response.Content)
{ {
var searchResults = await _json.DeserializeFromStreamAsync<MovieSearchResults>(json).ConfigureAwait(false); var searchResults = await _json.DeserializeFromStreamAsync<TmdbSearchResult<MovieResult>>(json).ConfigureAwait(false);
var results = searchResults.results ?? new List<MovieResult>(); var results = searchResults.Results ?? new List<MovieResult>();
return results return results
.Select(i => .Select(i =>
@ -172,21 +172,21 @@ namespace MediaBrowser.Providers.Tmdb.Movies
var remoteResult = new RemoteSearchResult var remoteResult = new RemoteSearchResult
{ {
SearchProviderName = TmdbMovieProvider.Current.Name, SearchProviderName = TmdbMovieProvider.Current.Name,
Name = i.title ?? i.name ?? i.original_title, Name = i.Title ?? i.Name ?? i.Original_Title,
ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path
}; };
if (!string.IsNullOrWhiteSpace(i.release_date)) if (!string.IsNullOrWhiteSpace(i.Release_Date))
{ {
// These dates are always in this exact format // These dates are always in this exact format
if (DateTime.TryParseExact(i.release_date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out var r)) if (DateTime.TryParseExact(i.Release_Date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out var r))
{ {
remoteResult.PremiereDate = r.ToUniversalTime(); remoteResult.PremiereDate = r.ToUniversalTime();
remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year; remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year;
} }
} }
remoteResult.SetProviderId(MetadataProviders.Tmdb, i.id.ToString(EnUs)); remoteResult.SetProviderId(MetadataProviders.Tmdb, i.Id.ToString(EnUs));
return remoteResult; return remoteResult;
@ -215,9 +215,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies
{ {
using (var json = response.Content) using (var json = response.Content)
{ {
var searchResults = await _json.DeserializeFromStreamAsync<TvSearchResults>(json).ConfigureAwait(false); var searchResults = await _json.DeserializeFromStreamAsync<TmdbSearchResult<TvResult>>(json).ConfigureAwait(false);
var results = searchResults.results ?? new List<TvResult>(); var results = searchResults.Results ?? new List<TvResult>();
return results return results
.Select(i => .Select(i =>
@ -225,21 +225,21 @@ namespace MediaBrowser.Providers.Tmdb.Movies
var remoteResult = new RemoteSearchResult var remoteResult = new RemoteSearchResult
{ {
SearchProviderName = TmdbMovieProvider.Current.Name, SearchProviderName = TmdbMovieProvider.Current.Name,
Name = i.name ?? i.original_name, Name = i.Name ?? i.Original_Name,
ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path ImageUrl = string.IsNullOrWhiteSpace(i.Poster_Path) ? null : baseImageUrl + i.Poster_Path
}; };
if (!string.IsNullOrWhiteSpace(i.first_air_date)) if (!string.IsNullOrWhiteSpace(i.First_Air_Date))
{ {
// These dates are always in this exact format // These dates are always in this exact format
if (DateTime.TryParseExact(i.first_air_date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out var r)) if (DateTime.TryParseExact(i.First_Air_Date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out var r))
{ {
remoteResult.PremiereDate = r.ToUniversalTime(); remoteResult.PremiereDate = r.ToUniversalTime();
remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year; remoteResult.ProductionYear = remoteResult.PremiereDate.Value.Year;
} }
} }
remoteResult.SetProviderId(MetadataProviders.Tmdb, i.id.ToString(EnUs)); remoteResult.SetProviderId(MetadataProviders.Tmdb, i.Id.ToString(EnUs));
return remoteResult; return remoteResult;

View File

@ -6,12 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.People
{ {
public class TmdbPersonExternalId : IExternalId public class TmdbPersonExternalId : IExternalId
{ {
/// <inheritdoc />
public string Name => TmdbUtils.ProviderName; public string Name => TmdbUtils.ProviderName;
/// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) public bool Supports(IHasProviderIds item)
{ {
return item is Person; return item is Person;

View File

@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.Tmdb.People
var result = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath); var result = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath);
var images = result.images ?? new PersonImages(); var images = result.Images ?? new PersonImages();
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
@ -76,16 +76,16 @@ namespace MediaBrowser.Providers.Tmdb.People
{ {
var list = new List<RemoteImageInfo>(); var list = new List<RemoteImageInfo>();
if (images.profiles != null) if (images.Profiles != null)
{ {
list.AddRange(images.profiles.Select(i => new RemoteImageInfo list.AddRange(images.Profiles.Select(i => new RemoteImageInfo
{ {
ProviderName = Name, ProviderName = Name,
Type = ImageType.Primary, Type = ImageType.Primary,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
Language = GetLanguage(i), Language = GetLanguage(i),
Url = baseImageUrl + i.file_path Url = baseImageUrl + i.File_Path
})); }));
} }
@ -118,7 +118,7 @@ namespace MediaBrowser.Providers.Tmdb.People
private string GetLanguage(Profile profile) private string GetLanguage(Profile profile)
{ {
return profile.iso_639_1?.ToString(); return profile.Iso_639_1?.ToString();
} }
public int Order => 0; public int Order => 0;

View File

@ -19,6 +19,7 @@ using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Tmdb.Models.General; using MediaBrowser.Providers.Tmdb.Models.General;
using MediaBrowser.Providers.Tmdb.Models.People; using MediaBrowser.Providers.Tmdb.Models.People;
using MediaBrowser.Providers.Tmdb.Models.Search;
using MediaBrowser.Providers.Tmdb.Movies; using MediaBrowser.Providers.Tmdb.Movies;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -63,19 +64,19 @@ namespace MediaBrowser.Providers.Tmdb.People
var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId); var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId);
var info = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath); var info = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath);
var images = (info.images ?? new PersonImages()).profiles ?? new List<Profile>(); var images = (info.Images ?? new PersonImages()).Profiles ?? new List<Profile>();
var result = new RemoteSearchResult var result = new RemoteSearchResult
{ {
Name = info.name, Name = info.Name,
SearchProviderName = Name, SearchProviderName = Name,
ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].file_path) ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].File_Path)
}; };
result.SetProviderId(MetadataProviders.Tmdb, info.id.ToString(_usCulture)); result.SetProviderId(MetadataProviders.Tmdb, info.Id.ToString(_usCulture));
result.SetProviderId(MetadataProviders.Imdb, info.imdb_id); result.SetProviderId(MetadataProviders.Imdb, info.Imdb_Id);
return new[] { result }; return new[] { result };
} }
@ -98,8 +99,8 @@ namespace MediaBrowser.Providers.Tmdb.People
{ {
using (var json = response.Content) using (var json = response.Content)
{ {
var result = await _jsonSerializer.DeserializeFromStreamAsync<PersonSearchResults>(json).ConfigureAwait(false) ?? var result = await _jsonSerializer.DeserializeFromStreamAsync<TmdbSearchResult<PersonSearchResult>>(json).ConfigureAwait(false) ??
new PersonSearchResults(); new TmdbSearchResult<PersonSearchResult>();
return result.Results.Select(i => GetSearchResult(i, tmdbImageUrl)); return result.Results.Select(i => GetSearchResult(i, tmdbImageUrl));
} }
@ -163,27 +164,27 @@ namespace MediaBrowser.Providers.Tmdb.People
//item.HomePageUrl = info.homepage; //item.HomePageUrl = info.homepage;
if (!string.IsNullOrWhiteSpace(info.place_of_birth)) if (!string.IsNullOrWhiteSpace(info.Place_Of_Birth))
{ {
item.ProductionLocations = new string[] { info.place_of_birth }; item.ProductionLocations = new string[] { info.Place_Of_Birth };
} }
item.Overview = info.biography; item.Overview = info.Biography;
if (DateTime.TryParseExact(info.birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out var date)) if (DateTime.TryParseExact(info.Birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out var date))
{ {
item.PremiereDate = date.ToUniversalTime(); item.PremiereDate = date.ToUniversalTime();
} }
if (DateTime.TryParseExact(info.deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date)) if (DateTime.TryParseExact(info.Deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
{ {
item.EndDate = date.ToUniversalTime(); item.EndDate = date.ToUniversalTime();
} }
item.SetProviderId(MetadataProviders.Tmdb, info.id.ToString(_usCulture)); item.SetProviderId(MetadataProviders.Tmdb, info.Id.ToString(_usCulture));
if (!string.IsNullOrEmpty(info.imdb_id)) if (!string.IsNullOrEmpty(info.Imdb_Id))
{ {
item.SetProviderId(MetadataProviders.Imdb, info.imdb_id); item.SetProviderId(MetadataProviders.Imdb, info.Imdb_Id);
} }
result.HasMetadata = true; result.HasMetadata = true;

View File

@ -68,14 +68,14 @@ namespace MediaBrowser.Providers.Tmdb.TV
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original"); var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
list.AddRange(GetPosters(response.images).Select(i => new RemoteImageInfo list.AddRange(GetPosters(response.Images).Select(i => new RemoteImageInfo
{ {
Url = tmdbImageUrl + i.file_path, Url = tmdbImageUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language),
ProviderName = Name, ProviderName = Name,
Type = ImageType.Primary, Type = ImageType.Primary,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -110,7 +110,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
private IEnumerable<Still> GetPosters(StillImages images) private IEnumerable<Still> GetPosters(StillImages images)
{ {
return images.stills ?? new List<Still>(); return images.Stills ?? new List<Still>();
} }

View File

@ -93,7 +93,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
result.HasMetadata = true; result.HasMetadata = true;
result.QueriedById = true; result.QueriedById = true;
if (!string.IsNullOrEmpty(response.overview)) if (!string.IsNullOrEmpty(response.Overview))
{ {
// if overview is non-empty, we can assume that localized data was returned // if overview is non-empty, we can assume that localized data was returned
result.ResultLanguage = info.MetadataLanguage; result.ResultLanguage = info.MetadataLanguage;
@ -107,29 +107,29 @@ namespace MediaBrowser.Providers.Tmdb.TV
item.ParentIndexNumber = info.ParentIndexNumber; item.ParentIndexNumber = info.ParentIndexNumber;
item.IndexNumberEnd = info.IndexNumberEnd; item.IndexNumberEnd = info.IndexNumberEnd;
if (response.external_ids.tvdb_id > 0) if (response.External_Ids.Tvdb_Id > 0)
{ {
item.SetProviderId(MetadataProviders.Tvdb, response.external_ids.tvdb_id.ToString(CultureInfo.InvariantCulture)); item.SetProviderId(MetadataProviders.Tvdb, response.External_Ids.Tvdb_Id.ToString(CultureInfo.InvariantCulture));
} }
item.PremiereDate = response.air_date; item.PremiereDate = response.Air_Date;
item.ProductionYear = result.Item.PremiereDate.Value.Year; item.ProductionYear = result.Item.PremiereDate.Value.Year;
item.Name = response.name; item.Name = response.Name;
item.Overview = response.overview; item.Overview = response.Overview;
item.CommunityRating = (float)response.vote_average; item.CommunityRating = (float)response.Vote_Average;
if (response.videos?.results != null) if (response.Videos?.Results != null)
{ {
foreach (var video in response.videos.results) foreach (var video in response.Videos.Results)
{ {
if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase) if (video.Type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|| video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase)) || video.Type.Equals("clip", System.StringComparison.OrdinalIgnoreCase))
{ {
if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase)) if (video.Site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase))
{ {
var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key); var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.Key);
item.AddTrailerUrl(videoUrl); item.AddTrailerUrl(videoUrl);
} }
} }
@ -138,30 +138,30 @@ namespace MediaBrowser.Providers.Tmdb.TV
result.ResetPeople(); result.ResetPeople();
var credits = response.credits; var credits = response.Credits;
if (credits != null) if (credits != null)
{ {
//Actors, Directors, Writers - all in People //Actors, Directors, Writers - all in People
//actors come from cast //actors come from cast
if (credits.cast != null) if (credits.Cast != null)
{ {
foreach (var actor in credits.cast.OrderBy(a => a.order)) foreach (var actor in credits.Cast.OrderBy(a => a.Order))
{ {
result.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor, SortOrder = actor.order }); result.AddPerson(new PersonInfo { Name = actor.Name.Trim(), Role = actor.Character, Type = PersonType.Actor, SortOrder = actor.Order });
} }
} }
// guest stars // guest stars
if (credits.guest_stars != null) if (credits.Guest_Stars != null)
{ {
foreach (var guest in credits.guest_stars.OrderBy(a => a.order)) foreach (var guest in credits.Guest_Stars.OrderBy(a => a.Order))
{ {
result.AddPerson(new PersonInfo { Name = guest.name.Trim(), Role = guest.character, Type = PersonType.GuestStar, SortOrder = guest.order }); result.AddPerson(new PersonInfo { Name = guest.Name.Trim(), Role = guest.Character, Type = PersonType.GuestStar, SortOrder = guest.Order });
} }
} }
//and the rest from crew //and the rest from crew
if (credits.crew != null) if (credits.Crew != null)
{ {
var keepTypes = new[] var keepTypes = new[]
{ {
@ -170,18 +170,18 @@ namespace MediaBrowser.Providers.Tmdb.TV
PersonType.Producer PersonType.Producer
}; };
foreach (var person in credits.crew) foreach (var person in credits.Crew)
{ {
// Normalize this // Normalize this
var type = TmdbUtils.MapCrewToPersonType(person); var type = TmdbUtils.MapCrewToPersonType(person);
if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) && if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) &&
!keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) !keepTypes.Contains(person.Job ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{ {
continue; continue;
} }
result.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = type }); result.AddPerson(new PersonInfo { Name = person.Name.Trim(), Role = person.Job, Type = type });
} }
} }
} }

View File

@ -67,31 +67,31 @@ namespace MediaBrowser.Providers.Tmdb.TV
result.Item.IndexNumber = seasonNumber; result.Item.IndexNumber = seasonNumber;
result.Item.Overview = seasonInfo.overview; result.Item.Overview = seasonInfo.Overview;
if (seasonInfo.external_ids.tvdb_id > 0) if (seasonInfo.External_Ids.Tvdb_Id > 0)
{ {
result.Item.SetProviderId(MetadataProviders.Tvdb, seasonInfo.external_ids.tvdb_id.ToString(CultureInfo.InvariantCulture)); result.Item.SetProviderId(MetadataProviders.Tvdb, seasonInfo.External_Ids.Tvdb_Id.ToString(CultureInfo.InvariantCulture));
} }
var credits = seasonInfo.credits; var credits = seasonInfo.Credits;
if (credits != null) if (credits != null)
{ {
//Actors, Directors, Writers - all in People //Actors, Directors, Writers - all in People
//actors come from cast //actors come from cast
if (credits.cast != null) if (credits.Cast != null)
{ {
//foreach (var actor in credits.cast.OrderBy(a => a.order)) result.Item.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor, SortOrder = actor.order }); //foreach (var actor in credits.cast.OrderBy(a => a.order)) result.Item.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor, SortOrder = actor.order });
} }
//and the rest from crew //and the rest from crew
if (credits.crew != null) if (credits.Crew != null)
{ {
//foreach (var person in credits.crew) result.Item.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department }); //foreach (var person in credits.crew) result.Item.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department });
} }
} }
result.Item.PremiereDate = seasonInfo.air_date; result.Item.PremiereDate = seasonInfo.Air_Date;
result.Item.ProductionYear = result.Item.PremiereDate.Value.Year; result.Item.ProductionYear = result.Item.PremiereDate.Value.Year;
} }
catch (HttpException ex) catch (HttpException ex)

View File

@ -6,12 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.TV
{ {
public class TmdbSeriesExternalId : IExternalId public class TmdbSeriesExternalId : IExternalId
{ {
/// <inheritdoc />
public string Name => TmdbUtils.ProviderName; public string Name => TmdbUtils.ProviderName;
/// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";
/// <inheritdoc />
public bool Supports(IHasProviderIds item) public bool Supports(IHasProviderIds item)
{ {
return item is Series; return item is Series;

View File

@ -69,12 +69,12 @@ namespace MediaBrowser.Providers.Tmdb.TV
list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
{ {
Url = tmdbImageUrl + i.file_path, Url = tmdbImageUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language),
ProviderName = Name, ProviderName = Name,
Type = ImageType.Primary, Type = ImageType.Primary,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -82,11 +82,11 @@ namespace MediaBrowser.Providers.Tmdb.TV
list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo
{ {
Url = tmdbImageUrl + i.file_path, Url = tmdbImageUrl + i.File_Path,
CommunityRating = i.vote_average, CommunityRating = i.Vote_Average,
VoteCount = i.vote_count, VoteCount = i.Vote_Count,
Width = i.width, Width = i.Width,
Height = i.height, Height = i.Height,
ProviderName = Name, ProviderName = Name,
Type = ImageType.Backdrop, Type = ImageType.Backdrop,
RatingType = RatingType.Score RatingType = RatingType.Score
@ -123,7 +123,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
/// <param name="images">The images.</param> /// <param name="images">The images.</param>
private IEnumerable<Poster> GetPosters(Images images) private IEnumerable<Poster> GetPosters(Images images)
{ {
return images.posters ?? new List<Poster>(); return images.Posters ?? new List<Poster>();
} }
/// <summary> /// <summary>
@ -132,10 +132,10 @@ namespace MediaBrowser.Providers.Tmdb.TV
/// <param name="images">The images.</param> /// <param name="images">The images.</param>
private IEnumerable<Backdrop> GetBackdrops(Images images) private IEnumerable<Backdrop> GetBackdrops(Images images)
{ {
var eligibleBackdrops = images.backdrops ?? new List<Backdrop>(); var eligibleBackdrops = images.Backdrops ?? new List<Backdrop>();
return eligibleBackdrops.OrderByDescending(i => i.vote_average) return eligibleBackdrops.OrderByDescending(i => i.Vote_Average)
.ThenByDescending(i => i.vote_count); .ThenByDescending(i => i.Vote_Count);
} }
/// <summary> /// <summary>
@ -166,7 +166,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
if (fileInfo.Exists) if (fileInfo.Exists)
{ {
return jsonSerializer.DeserializeFromFile<SeriesResult>(path).images; return jsonSerializer.DeserializeFromFile<SeriesResult>(path).Images;
} }
} }

View File

@ -73,17 +73,17 @@ namespace MediaBrowser.Providers.Tmdb.TV
var remoteResult = new RemoteSearchResult var remoteResult = new RemoteSearchResult
{ {
Name = obj.name, Name = obj.Name,
SearchProviderName = 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.Tmdb, obj.Id.ToString(_usCulture));
remoteResult.SetProviderId(MetadataProviders.Imdb, obj.external_ids.imdb_id); 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 }; return new[] { remoteResult };
@ -187,7 +187,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
return null; return null;
} }
tmdbId = seriesInfo.id.ToString(_usCulture); tmdbId = seriesInfo.Id.ToString(_usCulture);
string dataFilePath = GetDataFilePath(tmdbId, language); string dataFilePath = GetDataFilePath(tmdbId, language);
Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
@ -210,91 +210,91 @@ namespace MediaBrowser.Providers.Tmdb.TV
{ {
var series = seriesResult.Item; var series = seriesResult.Item;
series.Name = seriesInfo.name; series.Name = seriesInfo.Name;
series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture)); series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.Id.ToString(_usCulture));
//series.VoteCount = seriesInfo.vote_count; //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))
{ {
series.CommunityRating = 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.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.Status = SeriesStatus.Ended;
series.EndDate = seriesInfo.last_air_date; series.EndDate = seriesInfo.Last_Air_Date;
} }
else else
{ {
series.Status = SeriesStatus.Continuing; 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 (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 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 usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase));
var minimumRelease = contentRatings.FirstOrDefault(); var minimumRelease = contentRatings.FirstOrDefault();
if (ourRelease != null) if (ourRelease != null)
{ {
series.OfficialRating = ourRelease.rating; series.OfficialRating = ourRelease.Rating;
} }
else if (usRelease != null) else if (usRelease != null)
{ {
series.OfficialRating = usRelease.rating; series.OfficialRating = usRelease.Rating;
} }
else if (minimumRelease != null) 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) if ((video.Type.Equals("trailer", StringComparison.OrdinalIgnoreCase)
|| video.type.Equals("clip", StringComparison.OrdinalIgnoreCase)) || video.Type.Equals("clip", StringComparison.OrdinalIgnoreCase))
&& video.site.Equals("youtube", 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}");
} }
} }
} }
@ -302,26 +302,26 @@ 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 && 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 var personInfo = new PersonInfo
{ {
Name = actor.name.Trim(), Name = actor.Name.Trim(),
Role = actor.character, Role = actor.Character,
Type = PersonType.Actor, 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); seriesResult.AddPerson(personInfo);
@ -396,7 +396,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
// If the language preference isn't english, then have the overview fallback to english if it's blank // If the language preference isn't english, then have the overview fallback to english if it's blank
if (mainResult != null && if (mainResult != null &&
string.IsNullOrEmpty(mainResult.overview) && string.IsNullOrEmpty(mainResult.Overview) &&
!string.IsNullOrEmpty(language) && !string.IsNullOrEmpty(language) &&
!string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
{ {
@ -422,7 +422,7 @@ namespace MediaBrowser.Providers.Tmdb.TV
{ {
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false); var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false);
mainResult.overview = englishResult.overview; mainResult.Overview = englishResult.Overview;
mainResult.ResultLanguage = "en"; mainResult.ResultLanguage = "en";
} }
} }
@ -487,9 +487,9 @@ namespace MediaBrowser.Providers.Tmdb.TV
{ {
var result = await _jsonSerializer.DeserializeFromStreamAsync<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) if (tv != null)
{ {
@ -498,12 +498,12 @@ namespace MediaBrowser.Providers.Tmdb.TV
var remoteResult = new RemoteSearchResult var remoteResult = new RemoteSearchResult
{ {
Name = tv.name, Name = tv.Name,
SearchProviderName = 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; return remoteResult;
} }

View File

@ -14,13 +14,13 @@ namespace MediaBrowser.Providers.Tmdb
public static string MapCrewToPersonType(Crew crew) public static string MapCrewToPersonType(Crew crew)
{ {
if (crew.department.Equals("production", StringComparison.InvariantCultureIgnoreCase) if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
&& crew.job.IndexOf("producer", StringComparison.InvariantCultureIgnoreCase) != -1) && crew.Job.IndexOf("producer", StringComparison.InvariantCultureIgnoreCase) != -1)
{ {
return PersonType.Producer; return PersonType.Producer;
} }
if (crew.department.Equals("writing", StringComparison.InvariantCultureIgnoreCase)) if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
{ {
return PersonType.Writer; return PersonType.Writer;
} }