From 82b0015b301d705dd74e59d78f1f6bf5baf8a832 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Sun, 18 Aug 2019 14:44:13 +0200 Subject: [PATCH] Fix style issues --- .../Tmdb/BoxSets/TmdbBoxSetExternalId.cs | 4 + .../Tmdb/BoxSets/TmdbBoxSetImageProvider.cs | 34 +++--- .../Tmdb/BoxSets/TmdbBoxSetProvider.cs | 16 +-- .../Models/Collections/CollectionImages.cs | 4 +- .../Models/Collections/CollectionResult.cs | 14 +-- .../Tmdb/Models/Collections/Part.cs | 10 +- .../Tmdb/Models/General/Backdrop.cs | 14 +-- .../Tmdb/Models/General/Crew.cs | 12 +- .../Tmdb/Models/General/ExternalIds.cs | 10 +- .../Tmdb/Models/General/Genre.cs | 4 +- .../Tmdb/Models/General/Images.cs | 4 +- .../Tmdb/Models/General/Keyword.cs | 4 +- .../Tmdb/Models/General/Keywords.cs | 2 +- .../Tmdb/Models/General/Poster.cs | 14 +-- .../Tmdb/Models/General/Profile.cs | 10 +- .../Tmdb/Models/General/Still.cs | 16 +-- .../Tmdb/Models/General/StillImages.cs | 2 +- .../Tmdb/Models/General/Video.cs | 16 +-- .../Tmdb/Models/General/Videos.cs | 2 +- .../Tmdb/Models/Movies/BelongsToCollection.cs | 8 +- .../Tmdb/Models/Movies/Cast.cs | 12 +- .../Tmdb/Models/Movies/Casts.cs | 4 +- .../Tmdb/Models/Movies/Country.cs | 6 +- .../Tmdb/Models/Movies/MovieResult.cs | 64 +++++------ .../Tmdb/Models/Movies/ProductionCompany.cs | 4 +- .../Tmdb/Models/Movies/ProductionCountry.cs | 4 +- .../Tmdb/Models/Movies/Releases.cs | 2 +- .../Tmdb/Models/Movies/SpokenLanguage.cs | 4 +- .../Tmdb/Models/Movies/Trailers.cs | 2 +- .../Tmdb/Models/Movies/Youtube.cs | 6 +- .../Tmdb/Models/People/PersonImages.cs | 2 +- .../Tmdb/Models/People/PersonResult.cs | 28 ++--- .../Tmdb/Models/People/PersonSearchResults.cs | 28 ----- .../Models/Search/ExternalIdLookupResult.cs | 2 +- .../Tmdb/Models/Search/MovieResult.cs | 24 ++-- .../Tmdb/Models/Search/MovieSearchResults.cs | 28 ----- .../{People => Search}/PersonSearchResult.cs | 5 +- ...TvSearchResults.cs => TmdbSearchResult.cs} | 13 ++- .../Tmdb/Models/Search/TvResult.cs | 18 +-- MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs | 12 +- .../Tmdb/Models/TV/ContentRating.cs | 4 +- .../Tmdb/Models/TV/ContentRatings.cs | 2 +- .../Tmdb/Models/TV/CreatedBy.cs | 6 +- .../Tmdb/Models/TV/Credits.cs | 4 +- .../Tmdb/Models/TV/Episode.cs | 16 +-- .../Tmdb/Models/TV/EpisodeCredits.cs | 6 +- .../Tmdb/Models/TV/EpisodeResult.cs | 28 ++--- .../Tmdb/Models/TV/GuestStar.cs | 12 +- .../Tmdb/Models/TV/Network.cs | 4 +- .../Tmdb/Models/TV/Season.cs | 10 +- .../Tmdb/Models/TV/SeasonImages.cs | 2 +- .../Tmdb/Models/TV/SeasonResult.cs | 22 ++-- .../Tmdb/Models/TV/SeriesResult.cs | 58 +++++----- .../Tmdb/Movies/GenericTmdbMovieInfo.cs | 94 +++++++-------- .../Tmdb/Movies/TmdbImageProvider.cs | 36 +++--- .../Tmdb/Movies/TmdbMovieExternalId.cs | 4 + .../Tmdb/Movies/TmdbMovieProvider.cs | 16 +-- .../Tmdb/Movies/TmdbSearch.cs | 28 ++--- .../Tmdb/People/TmdbPersonExternalId.cs | 4 + .../Tmdb/People/TmdbPersonImageProvider.cs | 14 +-- .../Tmdb/People/TmdbPersonProvider.cs | 31 ++--- .../Tmdb/TV/TmdbEpisodeImageProvider.cs | 16 +-- .../Tmdb/TV/TmdbEpisodeProvider.cs | 48 ++++---- .../Tmdb/TV/TmdbSeasonProvider.cs | 14 +-- .../Tmdb/TV/TmdbSeriesExternalId.cs | 4 + .../Tmdb/TV/TmdbSeriesImageProvider.cs | 32 +++--- .../Tmdb/TV/TmdbSeriesProvider.cs | 108 +++++++++--------- MediaBrowser.Providers/Tmdb/TmdbUtils.cs | 6 +- 68 files changed, 532 insertions(+), 565 deletions(-) delete mode 100644 MediaBrowser.Providers/Tmdb/Models/People/PersonSearchResults.cs delete mode 100644 MediaBrowser.Providers/Tmdb/Models/Search/MovieSearchResults.cs rename MediaBrowser.Providers/Tmdb/Models/{People => Search}/PersonSearchResult.cs (93%) rename MediaBrowser.Providers/Tmdb/Models/Search/{TvSearchResults.cs => TmdbSearchResult.cs} (73%) diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs index a4f8f8a19..187295e1e 100644 --- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs @@ -7,12 +7,16 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets { public class TmdbBoxSetExternalId : IExternalId { + /// public string Name => TmdbUtils.ProviderName; + /// public string Key => MetadataProviders.TmdbCollection.ToString(); + /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}"; + /// public bool Supports(IHasProviderIds item) { return item is Movie || item is MusicVideo || item is Trailer; diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs index 23db6b90d..5db0edac2 100644 --- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs +++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetImageProvider.cs @@ -71,16 +71,16 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets { var list = new List(); - var images = obj.images ?? new CollectionImages(); + var images = obj.Images ?? new CollectionImages(); list.AddRange(GetPosters(images).Select(i => new RemoteImageInfo { - Url = baseUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, - Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), + Url = baseUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, + Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language), ProviderName = Name, Type = ImageType.Primary, RatingType = RatingType.Score @@ -88,11 +88,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets list.AddRange(GetBackdrops(images).Select(i => new RemoteImageInfo { - Url = baseUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, + Url = baseUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, ProviderName = Name, Type = ImageType.Backdrop, RatingType = RatingType.Score @@ -130,7 +130,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets /// IEnumerable{MovieDbProvider.Poster}. private IEnumerable GetPosters(CollectionImages images) { - return images.posters ?? new List(); + return images.Posters ?? new List(); } /// @@ -140,11 +140,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets /// IEnumerable{MovieDbProvider.Backdrop}. private IEnumerable GetBackdrops(CollectionImages images) { - var eligibleBackdrops = images.backdrops == null ? new List() : - images.backdrops; + var eligibleBackdrops = images.Backdrops == null ? new List() : + images.Backdrops; - return eligibleBackdrops.OrderByDescending(i => i.vote_average) - .ThenByDescending(i => i.vote_count); + return eligibleBackdrops.OrderByDescending(i => i.Vote_Average) + .ThenByDescending(i => i.Vote_Count); } public int Order => 0; diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetProvider.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetProvider.cs index 38e496fe3..a215177a9 100644 --- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetProvider.cs +++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetProvider.cs @@ -62,7 +62,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, searchInfo.MetadataLanguage); var info = _json.DeserializeFromFile(dataFilePath); - var images = (info.images ?? new CollectionImages()).posters ?? new List(); + var images = (info.Images ?? new CollectionImages()).Posters ?? new List(); var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); @@ -70,14 +70,14 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets var result = new RemoteSearchResult { - Name = info.name, + Name = info.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 }; } @@ -141,11 +141,11 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets { var item = new BoxSet { - Name = obj.name, - Overview = obj.overview + Name = obj.Name, + Overview = obj.Overview }; - item.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture)); + item.SetProviderId(MetadataProviders.Tmdb, obj.Id.ToString(_usCulture)); return item; } @@ -195,7 +195,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets 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)) { diff --git a/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionImages.cs b/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionImages.cs index fc4fc6f64..18f26c397 100644 --- a/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionImages.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionImages.cs @@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections { public class CollectionImages { - public List backdrops { get; set; } - public List posters { get; set; } + public List Backdrops { get; set; } + public List Posters { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionResult.cs b/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionResult.cs index 6bc47d9ac..53d2599f8 100644 --- a/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Collections/CollectionResult.cs @@ -4,12 +4,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections { public class CollectionResult { - public int id { get; set; } - public string name { get; set; } - public string overview { get; set; } - public string poster_path { get; set; } - public string backdrop_path { get; set; } - public List parts { get; set; } - public CollectionImages images { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Overview { get; set; } + public string Poster_Path { get; set; } + public string Backdrop_Path { get; set; } + public List Parts { get; set; } + public CollectionImages Images { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs b/MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs index a5611d69f..ff19291c7 100644 --- a/MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs @@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.Collections { public class Part { - public string title { get; set; } - public int id { get; set; } - public string release_date { get; set; } - public string poster_path { get; set; } - public string backdrop_path { get; set; } + public string Title { get; set; } + public int Id { get; set; } + public string Release_Date { get; set; } + public string Poster_Path { get; set; } + public string Backdrop_Path { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs b/MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs index 6a3ff824f..db4cd6681 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs @@ -2,12 +2,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Backdrop { - public double aspect_ratio { get; set; } - public string file_path { get; set; } - public int height { get; set; } - public string iso_639_1 { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } - public int width { get; set; } + public double Aspect_Ratio { get; set; } + public string File_Path { get; set; } + public int Height { get; set; } + public string Iso_639_1 { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } + public int Width { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Crew.cs b/MediaBrowser.Providers/Tmdb/Models/General/Crew.cs index de229f830..47b985403 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Crew.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Crew.cs @@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Crew { - public int id { get; set; } - public string credit_id { get; set; } - public string name { get; set; } - public string department { get; set; } - public string job { get; set; } - public string profile_path { get; set; } + public int Id { get; set; } + public string Credit_Id { get; set; } + public string Name { get; set; } + public string Department { get; set; } + public string Job { get; set; } + public string Profile_Path { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs b/MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs index e70fe2b98..37e37b0be 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs @@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class ExternalIds { - public string imdb_id { get; set; } - public object freebase_id { get; set; } - public string freebase_mid { get; set; } - public int tvdb_id { get; set; } - public int tvrage_id { get; set; } + public string Imdb_Id { get; set; } + public object Freebase_Id { get; set; } + public string Freebase_Mid { get; set; } + public int Tvdb_Id { get; set; } + public int Tvrage_Id { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Genre.cs b/MediaBrowser.Providers/Tmdb/Models/General/Genre.cs index 5dda28969..9a6686d50 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Genre.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Genre.cs @@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Genre { - public int id { get; set; } - public string name { get; set; } + public int Id { get; set; } + public string Name { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Images.cs b/MediaBrowser.Providers/Tmdb/Models/General/Images.cs index ee5401aa1..f1c99537d 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Images.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Images.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Images { - public List backdrops { get; set; } - public List posters { get; set; } + public List Backdrops { get; set; } + public List Posters { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs b/MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs index 590814005..4e3011349 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs @@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Keyword { - public int id { get; set; } - public string name { get; set; } + public int Id { get; set; } + public string Name { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs b/MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs index 3986e06f8..1950a51b3 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs @@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Keywords { - public List results { get; set; } + public List Results { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Poster.cs b/MediaBrowser.Providers/Tmdb/Models/General/Poster.cs index 4acb16a2b..33401b15d 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Poster.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Poster.cs @@ -2,12 +2,12 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Poster { - public double aspect_ratio { get; set; } - public string file_path { get; set; } - public int height { get; set; } - public string iso_639_1 { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } - public int width { get; set; } + public double Aspect_Ratio { get; set; } + public string File_Path { get; set; } + public int Height { get; set; } + public string Iso_639_1 { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } + public int Width { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Profile.cs b/MediaBrowser.Providers/Tmdb/Models/General/Profile.cs index 51e0bb6ca..73a049c73 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Profile.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Profile.cs @@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Profile { - public string file_path { get; set; } - public int width { get; set; } - public int height { get; set; } - public object iso_639_1 { get; set; } - public double aspect_ratio { get; set; } + public string File_Path { get; set; } + public int Width { get; set; } + public int Height { get; set; } + public object Iso_639_1 { get; set; } + public double Aspect_Ratio { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Still.cs b/MediaBrowser.Providers/Tmdb/Models/General/Still.cs index 75f57ddad..15ff4a099 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Still.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Still.cs @@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Still { - public double aspect_ratio { get; set; } - public string file_path { get; set; } - public int height { get; set; } - public string id { get; set; } - public string iso_639_1 { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } - public int width { get; set; } + public double Aspect_Ratio { get; set; } + public string File_Path { get; set; } + public int Height { get; set; } + public string Id { get; set; } + public string Iso_639_1 { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } + public int Width { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/StillImages.cs b/MediaBrowser.Providers/Tmdb/Models/General/StillImages.cs index 323c2131c..266965c47 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/StillImages.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/StillImages.cs @@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class StillImages { - public List stills { get; set; } + public List Stills { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Video.cs b/MediaBrowser.Providers/Tmdb/Models/General/Video.cs index 746b7f02b..fb69e7767 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Video.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Video.cs @@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { 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 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; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/General/Videos.cs b/MediaBrowser.Providers/Tmdb/Models/General/Videos.cs index 64d7d6e62..26812780d 100644 --- a/MediaBrowser.Providers/Tmdb/Models/General/Videos.cs +++ b/MediaBrowser.Providers/Tmdb/Models/General/Videos.cs @@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.General { public class Videos { - public List /// true if adult; otherwise, false. - public bool adult { get; set; } + public bool Adult { get; set; } /// /// Gets or sets the backdrop_path. /// /// The backdrop_path. - public string backdrop_path { get; set; } + public string Backdrop_Path { get; set; } /// /// Gets or sets the id. /// /// The id. - public int id { get; set; } + public int Id { get; set; } /// /// Gets or sets the original_title. /// /// The original_title. - public string original_title { get; set; } + public string Original_Title { get; set; } /// /// Gets or sets the original_name. /// /// The original_name. - public string original_name { get; set; } + public string Original_Name { get; set; } /// /// Gets or sets the release_date. /// /// The release_date. - public string release_date { get; set; } + public string Release_Date { get; set; } /// /// Gets or sets the poster_path. /// /// The poster_path. - public string poster_path { get; set; } + public string Poster_Path { get; set; } /// /// Gets or sets the popularity. /// /// The popularity. - public double popularity { get; set; } + public double Popularity { get; set; } /// /// Gets or sets the title. /// /// The title. - public string title { get; set; } + public string Title { get; set; } /// /// Gets or sets the vote_average. /// /// The vote_average. - public double vote_average { get; set; } + public double Vote_Average { get; set; } /// /// For collection search results /// - public string name { get; set; } + public string Name { get; set; } /// /// Gets or sets the vote_count. /// /// The vote_count. - public int vote_count { get; set; } + public int Vote_Count { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/Search/MovieSearchResults.cs b/MediaBrowser.Providers/Tmdb/Models/Search/MovieSearchResults.cs deleted file mode 100644 index c75a70e7e..000000000 --- a/MediaBrowser.Providers/Tmdb/Models/Search/MovieSearchResults.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; - -namespace MediaBrowser.Providers.Tmdb.Models.Search -{ - public class MovieSearchResults - { - /// - /// Gets or sets the page. - /// - /// The page. - public int page { get; set; } - /// - /// Gets or sets the results. - /// - /// The results. - public List results { get; set; } - /// - /// Gets or sets the total_pages. - /// - /// The total_pages. - public int total_pages { get; set; } - /// - /// Gets or sets the total_results. - /// - /// The total_results. - public int total_results { get; set; } - } -} diff --git a/MediaBrowser.Providers/Tmdb/Models/People/PersonSearchResult.cs b/MediaBrowser.Providers/Tmdb/Models/Search/PersonSearchResult.cs similarity index 93% rename from MediaBrowser.Providers/Tmdb/Models/People/PersonSearchResult.cs rename to MediaBrowser.Providers/Tmdb/Models/Search/PersonSearchResult.cs index 7410ebde9..93916068f 100644 --- a/MediaBrowser.Providers/Tmdb/Models/People/PersonSearchResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Search/PersonSearchResult.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Providers.Tmdb.Models.People +namespace MediaBrowser.Providers.Tmdb.Models.Search { public class PersonSearchResult { @@ -7,16 +7,19 @@ namespace MediaBrowser.Providers.Tmdb.Models.People /// /// true if adult; otherwise, false. public bool Adult { get; set; } + /// /// Gets or sets the id. /// /// The id. public int Id { get; set; } + /// /// Gets or sets the name. /// /// The name. public string Name { get; set; } + /// /// Gets or sets the profile_ path. /// diff --git a/MediaBrowser.Providers/Tmdb/Models/Search/TvSearchResults.cs b/MediaBrowser.Providers/Tmdb/Models/Search/TmdbSearchResult.cs similarity index 73% rename from MediaBrowser.Providers/Tmdb/Models/Search/TvSearchResults.cs rename to MediaBrowser.Providers/Tmdb/Models/Search/TmdbSearchResult.cs index 0fea2a04e..a9f888e75 100644 --- a/MediaBrowser.Providers/Tmdb/Models/Search/TvSearchResults.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Search/TmdbSearchResult.cs @@ -2,27 +2,30 @@ using System.Collections.Generic; namespace MediaBrowser.Providers.Tmdb.Models.Search { - public class TvSearchResults + public class TmdbSearchResult { /// /// Gets or sets the page. /// /// The page. - public int page { get; set; } + public int Page { get; set; } + /// /// Gets or sets the results. /// /// The results. - public List results { get; set; } + public List Results { get; set; } + /// /// Gets or sets the total_pages. /// /// The total_pages. - public int total_pages { get; set; } + public int Total_Pages { get; set; } + /// /// Gets or sets the total_results. /// /// The total_results. - public int total_results { get; set; } + public int Total_Results { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs b/MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs index a881b3877..ed140bedd 100644 --- a/MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs @@ -2,14 +2,14 @@ namespace MediaBrowser.Providers.Tmdb.Models.Search { public class TvResult { - public string backdrop_path { get; set; } - public string first_air_date { get; set; } - public int id { get; set; } - public string original_name { get; set; } - public string poster_path { get; set; } - public double popularity { get; set; } - public string name { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } + public string Backdrop_Path { get; set; } + public string First_Air_Date { get; set; } + public int Id { get; set; } + public string Original_Name { get; set; } + public string Poster_Path { get; set; } + public double Popularity { get; set; } + public string Name { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs b/MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs index d3b0ab069..c659df9ac 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs @@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class Cast { - public string character { get; set; } - public string credit_id { get; set; } - public int id { get; set; } - public string name { get; set; } - public string profile_path { get; set; } - public int order { get; set; } + public string Character { get; set; } + public string Credit_Id { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Profile_Path { get; set; } + public int Order { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs b/MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs index f9f1baeee..3177cd71b 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs @@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class ContentRating { - public string iso_3166_1 { get; set; } - public string rating { get; set; } + public string Iso_3166_1 { get; set; } + public string Rating { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs b/MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs index 2fb585582..883e605c9 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs @@ -4,6 +4,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class ContentRatings { - public List results { get; set; } + public List Results { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs b/MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs index 053cc0361..21588d897 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs @@ -2,8 +2,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class CreatedBy { - public int id { get; set; } - public string name { get; set; } - public string profile_path { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Profile_Path { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs b/MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs index bda1acc32..b62b5f605 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs @@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class Credits { - public List cast { get; set; } - public List crew { get; set; } + public List Cast { get; set; } + public List Crew { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs b/MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs index c9364672d..ab11a6cd2 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs @@ -2,13 +2,13 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class Episode { - public string air_date { get; set; } - public int episode_number { get; set; } - public int id { get; set; } - public string name { get; set; } - public string overview { get; set; } - public string still_path { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } + public string Air_Date { get; set; } + public int Episode_Number { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Overview { get; set; } + public string Still_Path { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs b/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs index 1b82c8426..1c86be0f4 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs @@ -5,8 +5,8 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class EpisodeCredits { - public List cast { get; set; } - public List crew { get; set; } - public List guest_stars { get; set; } + public List Cast { get; set; } + public List Crew { get; set; } + public List Guest_Stars { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs b/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs index d581217a1..0513ce7e2 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs @@ -5,19 +5,19 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class EpisodeResult { - public DateTime air_date { get; set; } - public int episode_number { get; set; } - public string name { get; set; } - public string overview { get; set; } - public int id { get; set; } - public object production_code { get; set; } - public int season_number { get; set; } - public string still_path { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } - public StillImages images { get; set; } - public ExternalIds external_ids { get; set; } - public EpisodeCredits credits { get; set; } - public Tmdb.Models.General.Videos videos { get; set; } + public DateTime Air_Date { get; set; } + public int Episode_Number { get; set; } + public string Name { get; set; } + public string Overview { get; set; } + public int Id { get; set; } + public object Production_Code { get; set; } + public int Season_Number { get; set; } + public string Still_Path { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } + public StillImages Images { get; set; } + public ExternalIds External_Ids { get; set; } + public EpisodeCredits Credits { get; set; } + public Tmdb.Models.General.Videos Videos { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs b/MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs index 9b1188818..2dfe7a862 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs @@ -2,11 +2,11 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class GuestStar { - public int id { get; set; } - public string name { get; set; } - public string credit_id { get; set; } - public string character { get; set; } - public int order { get; set; } - public string profile_path { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public string Credit_Id { get; set; } + public string Character { get; set; } + public int Order { get; set; } + public string Profile_Path { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/Network.cs b/MediaBrowser.Providers/Tmdb/Models/TV/Network.cs index 82a98380a..f982682d1 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/Network.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/Network.cs @@ -2,7 +2,7 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class Network { - public int id { get; set; } - public string name { get; set; } + public int Id { get; set; } + public string Name { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/Season.cs b/MediaBrowser.Providers/Tmdb/Models/TV/Season.cs index b85a0ec88..976e3c97e 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/Season.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/Season.cs @@ -2,10 +2,10 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class Season { - public string air_date { get; set; } - public int episode_count { get; set; } - public int id { get; set; } - public string poster_path { get; set; } - public int season_number { get; set; } + public string Air_Date { get; set; } + public int Episode_Count { get; set; } + public int Id { get; set; } + public string Poster_Path { get; set; } + public int Season_Number { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs b/MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs index bc169088e..9a93dd6ae 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs @@ -5,6 +5,6 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class SeasonImages { - public List posters { get; set; } + public List Posters { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs b/MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs index 768bb82e9..bc9213c04 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs @@ -6,16 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class SeasonResult { - public DateTime air_date { get; set; } - public List episodes { get; set; } - public string name { get; set; } - public string overview { get; set; } - public int id { get; set; } - public string poster_path { get; set; } - public int season_number { get; set; } - public Credits credits { get; set; } - public SeasonImages images { get; set; } - public ExternalIds external_ids { get; set; } - public General.Videos videos { get; set; } + public DateTime Air_Date { get; set; } + public List Episodes { get; set; } + public string Name { get; set; } + public string Overview { get; set; } + public int Id { get; set; } + public string Poster_Path { get; set; } + public int Season_Number { get; set; } + public Credits Credits { get; set; } + public SeasonImages Images { get; set; } + public ExternalIds External_Ids { get; set; } + public General.Videos Videos { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs b/MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs index d9b631bd0..ad95e502e 100644 --- a/MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs +++ b/MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs @@ -6,35 +6,35 @@ namespace MediaBrowser.Providers.Tmdb.Models.TV { public class SeriesResult { - public string backdrop_path { get; set; } - public List created_by { get; set; } - public List episode_run_time { get; set; } - public DateTime first_air_date { get; set; } - public List genres { get; set; } - public string homepage { get; set; } - public int id { get; set; } - public bool in_production { get; set; } - public List languages { get; set; } - public DateTime last_air_date { get; set; } - public string name { get; set; } - public List networks { get; set; } - public int number_of_episodes { get; set; } - public int number_of_seasons { get; set; } - public string original_name { get; set; } - public List origin_country { get; set; } - public string overview { get; set; } - public string popularity { get; set; } - public string poster_path { get; set; } - public List seasons { get; set; } - public string status { get; set; } - public double vote_average { get; set; } - public int vote_count { get; set; } - public Credits credits { get; set; } - public Images images { get; set; } - public Keywords keywords { get; set; } - public ExternalIds external_ids { get; set; } - public General.Videos videos { get; set; } - public ContentRatings content_ratings { get; set; } + public string Backdrop_Path { get; set; } + public List Created_By { get; set; } + public List Episode_Run_Time { get; set; } + public DateTime First_Air_Date { get; set; } + public List Genres { get; set; } + public string Homepage { get; set; } + public int Id { get; set; } + public bool In_Production { get; set; } + public List Languages { get; set; } + public DateTime Last_Air_Date { get; set; } + public string Name { get; set; } + public List Networks { get; set; } + public int Number_Of_Episodes { get; set; } + public int Number_Of_Seasons { get; set; } + public string Original_Name { get; set; } + public List Origin_Country { get; set; } + public string Overview { get; set; } + public string Popularity { get; set; } + public string Poster_Path { get; set; } + public List Seasons { get; set; } + public string Status { get; set; } + public double Vote_Average { get; set; } + public int Vote_Count { get; set; } + public Credits Credits { get; set; } + public Images Images { get; set; } + public Keywords Keywords { get; set; } + public ExternalIds External_Ids { get; set; } + public General.Videos Videos { get; set; } + public ContentRatings Content_Ratings { get; set; } public string ResultLanguage { get; set; } } } diff --git a/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs b/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs index 09c51f816..b7b447b68 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/GenericTmdbMovieInfo.cs @@ -91,7 +91,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false); if (movieInfo != null) { - tmdbId = movieInfo.id.ToString(_usCulture); + tmdbId = movieInfo.Id.ToString(_usCulture); dataFilePath = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath)); @@ -130,39 +130,39 @@ namespace MediaBrowser.Providers.Tmdb.Movies 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.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 - .production_countries - .Select(i => i.name) + .Production_Countries + .Select(i => i.Name) .ToArray(); } - movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture)); - movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id); + movie.SetProviderId(MetadataProviders.Tmdb, movieData.Id.ToString(_usCulture)); + movie.SetProviderId(MetadataProviders.Imdb, movieData.Imdb_Id); - if (movieData.belongs_to_collection != null) + if (movieData.Belongs_To_Collection != null) { 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) { - 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)) { @@ -171,17 +171,17 @@ namespace MediaBrowser.Providers.Tmdb.Movies //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 usRelease = releases.FirstOrDefault(c => string.Equals(c.iso_3166_1, "US", 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)); if (ourRelease != null) { 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); @@ -189,14 +189,14 @@ namespace MediaBrowser.Providers.Tmdb.Movies } 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 - 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.ProductionYear = movie.PremiereDate.Value.Year; @@ -204,16 +204,16 @@ namespace MediaBrowser.Providers.Tmdb.Movies } //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 // Movies get this from imdb - var genres = movieData.genres ?? new List(); + var genres = movieData.Genres ?? new List(); - foreach (var genre in genres.Select(g => g.name)) + foreach (var genre in genres.Select(g => g.Name)) { movie.AddGenre(genre); } @@ -223,26 +223,26 @@ namespace MediaBrowser.Providers.Tmdb.Movies //Actors, Directors, Writers - all in People //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 { - Name = actor.name.Trim(), - Role = actor.character, + Name = actor.Name.Trim(), + Role = actor.Character, Type = PersonType.Actor, - SortOrder = actor.order + SortOrder = actor.Order }; - if (!string.IsNullOrWhiteSpace(actor.profile_path)) + if (!string.IsNullOrWhiteSpace(actor.Profile_Path)) { - personInfo.ImageUrl = tmdbImageUrl + actor.profile_path; + personInfo.ImageUrl = tmdbImageUrl + actor.Profile_Path; } - if (actor.id > 0) + if (actor.Id > 0) { - personInfo.SetProviderId(MetadataProviders.Tmdb, actor.id.ToString(CultureInfo.InvariantCulture)); + personInfo.SetProviderId(MetadataProviders.Tmdb, actor.Id.ToString(CultureInfo.InvariantCulture)); } resultItem.AddPerson(personInfo); @@ -250,7 +250,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies } //and the rest from crew - if (movieData.casts?.crew != null) + if (movieData.Casts?.Crew != null) { var keepTypes = new[] { @@ -259,32 +259,32 @@ namespace MediaBrowser.Providers.Tmdb.Movies PersonType.Producer }; - foreach (var person in movieData.casts.crew) + foreach (var person in movieData.Casts.Crew) { // Normalize this var type = TmdbUtils.MapCrewToPersonType(person); if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) && - !keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) + !keepTypes.Contains(person.Job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) { continue; } var personInfo = new PersonInfo { - Name = person.name.Trim(), - Role = person.job, + Name = person.Name.Trim(), + Role = person.Job, 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); @@ -296,12 +296,12 @@ namespace MediaBrowser.Providers.Tmdb.Movies // 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), - Name = i.name + Url = string.Format("https://www.youtube.com/watch?v={0}", i.Source), + Name = i.Name }).ToArray(); } diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs index c0cd22978..cdb96e6ac 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbImageProvider.cs @@ -73,12 +73,12 @@ namespace MediaBrowser.Providers.Tmdb.Movies { list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo { - Url = tmdbImageUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, - Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), + Url = tmdbImageUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, + Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language), ProviderName = Name, Type = ImageType.Primary, RatingType = RatingType.Score @@ -89,11 +89,11 @@ namespace MediaBrowser.Providers.Tmdb.Movies { list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo { - Url = tmdbImageUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, + Url = tmdbImageUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, ProviderName = Name, Type = ImageType.Backdrop, RatingType = RatingType.Score @@ -132,7 +132,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies /// IEnumerable{MovieDbProvider.Poster}. private IEnumerable GetPosters(Images images) { - return images.posters ?? new List(); + return images.Posters ?? new List(); } /// @@ -142,11 +142,11 @@ namespace MediaBrowser.Providers.Tmdb.Movies /// IEnumerable{MovieDbProvider.Backdrop}. private IEnumerable GetBackdrops(Images images) { - var eligibleBackdrops = images.backdrops == null ? new List() : - images.backdrops; + var eligibleBackdrops = images.Backdrops == null ? new List() : + images.Backdrops; - return eligibleBackdrops.OrderByDescending(i => i.vote_average) - .ThenByDescending(i => i.vote_count); + return eligibleBackdrops.OrderByDescending(i => i.Vote_Average) + .ThenByDescending(i => i.Vote_Count); } /// @@ -169,7 +169,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies var movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false); 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) { - return jsonSerializer.DeserializeFromFile(path).images; + return jsonSerializer.DeserializeFromFile(path).Images; } } diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs index 8e735d1a1..fc7a4583f 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs @@ -8,12 +8,16 @@ namespace MediaBrowser.Providers.Tmdb.Movies { public class TmdbMovieExternalId : IExternalId { + /// public string Name => TmdbUtils.ProviderName; + /// public string Key => MetadataProviders.Tmdb.ToString(); + /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}"; + /// public bool Supports(IHasProviderIds item) { // Supports images for tv movies diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs index 0627ed33a..a1bea5847 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieProvider.cs @@ -83,24 +83,24 @@ namespace MediaBrowser.Providers.Tmdb.Movies { Name = obj.GetTitle(), 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 - 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.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 }; @@ -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 (mainResult != null && - string.IsNullOrEmpty(mainResult.overview) && + string.IsNullOrEmpty(mainResult.Overview) && !string.IsNullOrEmpty(language) && !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) { @@ -392,7 +392,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies { var englishResult = await _jsonSerializer.DeserializeFromStreamAsync(json).ConfigureAwait(false); - mainResult.overview = englishResult.overview; + mainResult.Overview = englishResult.Overview; } } } diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbSearch.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbSearch.cs index 00ccb5d0c..223cef086 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/TmdbSearch.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbSearch.cs @@ -162,9 +162,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies { using (var json = response.Content) { - var searchResults = await _json.DeserializeFromStreamAsync(json).ConfigureAwait(false); + var searchResults = await _json.DeserializeFromStreamAsync>(json).ConfigureAwait(false); - var results = searchResults.results ?? new List(); + var results = searchResults.Results ?? new List(); return results .Select(i => @@ -172,21 +172,21 @@ namespace MediaBrowser.Providers.Tmdb.Movies var remoteResult = new RemoteSearchResult { SearchProviderName = TmdbMovieProvider.Current.Name, - Name = i.title ?? i.name ?? i.original_title, - ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path + Name = i.Title ?? i.Name ?? i.Original_Title, + 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 - 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.ProductionYear = remoteResult.PremiereDate.Value.Year; } } - remoteResult.SetProviderId(MetadataProviders.Tmdb, i.id.ToString(EnUs)); + remoteResult.SetProviderId(MetadataProviders.Tmdb, i.Id.ToString(EnUs)); return remoteResult; @@ -215,9 +215,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies { using (var json = response.Content) { - var searchResults = await _json.DeserializeFromStreamAsync(json).ConfigureAwait(false); + var searchResults = await _json.DeserializeFromStreamAsync>(json).ConfigureAwait(false); - var results = searchResults.results ?? new List(); + var results = searchResults.Results ?? new List(); return results .Select(i => @@ -225,21 +225,21 @@ namespace MediaBrowser.Providers.Tmdb.Movies var remoteResult = new RemoteSearchResult { SearchProviderName = TmdbMovieProvider.Current.Name, - Name = i.name ?? i.original_name, - ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path + Name = i.Name ?? i.Original_Name, + 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 - 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.ProductionYear = remoteResult.PremiereDate.Value.Year; } } - remoteResult.SetProviderId(MetadataProviders.Tmdb, i.id.ToString(EnUs)); + remoteResult.SetProviderId(MetadataProviders.Tmdb, i.Id.ToString(EnUs)); return remoteResult; diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs index 3164b8945..2c61bc70a 100644 --- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs @@ -6,12 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.People { public class TmdbPersonExternalId : IExternalId { + /// public string Name => TmdbUtils.ProviderName; + /// public string Key => MetadataProviders.Tmdb.ToString(); + /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}"; + /// public bool Supports(IHasProviderIds item) { return item is Person; diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs index c3b77823a..44ccbf453 100644 --- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs +++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonImageProvider.cs @@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.Tmdb.People var result = _jsonSerializer.DeserializeFromFile(dataFilePath); - var images = result.images ?? new PersonImages(); + var images = result.Images ?? new PersonImages(); var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); @@ -76,16 +76,16 @@ namespace MediaBrowser.Providers.Tmdb.People { var list = new List(); - 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, Type = ImageType.Primary, - Width = i.width, - Height = i.height, + Width = i.Width, + Height = i.Height, 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) { - return profile.iso_639_1?.ToString(); + return profile.Iso_639_1?.ToString(); } public int Order => 0; diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs index d29ce3160..130403e4d 100644 --- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs +++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonProvider.cs @@ -19,6 +19,7 @@ using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; using MediaBrowser.Providers.Tmdb.Models.General; using MediaBrowser.Providers.Tmdb.Models.People; +using MediaBrowser.Providers.Tmdb.Models.Search; using MediaBrowser.Providers.Tmdb.Movies; using Microsoft.Extensions.Logging; @@ -63,19 +64,19 @@ namespace MediaBrowser.Providers.Tmdb.People var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId); var info = _jsonSerializer.DeserializeFromFile(dataFilePath); - var images = (info.images ?? new PersonImages()).profiles ?? new List(); + var images = (info.Images ?? new PersonImages()).Profiles ?? new List(); var result = new RemoteSearchResult { - Name = info.name, + Name = info.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.Imdb, info.imdb_id); + result.SetProviderId(MetadataProviders.Tmdb, info.Id.ToString(_usCulture)); + result.SetProviderId(MetadataProviders.Imdb, info.Imdb_Id); return new[] { result }; } @@ -98,8 +99,8 @@ namespace MediaBrowser.Providers.Tmdb.People { using (var json = response.Content) { - var result = await _jsonSerializer.DeserializeFromStreamAsync(json).ConfigureAwait(false) ?? - new PersonSearchResults(); + var result = await _jsonSerializer.DeserializeFromStreamAsync>(json).ConfigureAwait(false) ?? + new TmdbSearchResult(); return result.Results.Select(i => GetSearchResult(i, tmdbImageUrl)); } @@ -163,27 +164,27 @@ namespace MediaBrowser.Providers.Tmdb.People //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(); } - 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.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; diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs index 1a09d5e04..51e7891a1 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeImageProvider.cs @@ -68,14 +68,14 @@ namespace MediaBrowser.Providers.Tmdb.TV 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, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, - Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), + Url = tmdbImageUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, + Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language), ProviderName = Name, Type = ImageType.Primary, RatingType = RatingType.Score @@ -110,7 +110,7 @@ namespace MediaBrowser.Providers.Tmdb.TV private IEnumerable GetPosters(StillImages images) { - return images.stills ?? new List(); + return images.Stills ?? new List(); } diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProvider.cs index c95096390..a17f5d17a 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbEpisodeProvider.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Providers.Tmdb.TV result.HasMetadata = 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 result.ResultLanguage = info.MetadataLanguage; @@ -107,29 +107,29 @@ namespace MediaBrowser.Providers.Tmdb.TV item.ParentIndexNumber = info.ParentIndexNumber; 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.Name = response.name; - item.Overview = response.overview; + item.Name = response.Name; + 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) - || video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase)) + if (video.Type.Equals("trailer", 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); } } @@ -138,30 +138,30 @@ namespace MediaBrowser.Providers.Tmdb.TV result.ResetPeople(); - var credits = response.credits; + var credits = response.Credits; if (credits != null) { //Actors, Directors, Writers - all in People //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 - 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 - if (credits.crew != null) + if (credits.Crew != null) { var keepTypes = new[] { @@ -170,18 +170,18 @@ namespace MediaBrowser.Providers.Tmdb.TV PersonType.Producer }; - foreach (var person in credits.crew) + foreach (var person in credits.Crew) { // Normalize this var type = TmdbUtils.MapCrewToPersonType(person); if (!keepTypes.Contains(type, StringComparer.OrdinalIgnoreCase) && - !keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) + !keepTypes.Contains(person.Job ?? string.Empty, StringComparer.OrdinalIgnoreCase)) { 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 }); } } } diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs index 007110bfb..2f2ac58e8 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeasonProvider.cs @@ -67,31 +67,31 @@ namespace MediaBrowser.Providers.Tmdb.TV 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) { //Actors, Directors, Writers - all in People //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 }); } //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 }); } } - result.Item.PremiereDate = seasonInfo.air_date; + result.Item.PremiereDate = seasonInfo.Air_Date; result.Item.ProductionYear = result.Item.PremiereDate.Value.Year; } catch (HttpException ex) diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs index cc5db6871..524a3b05e 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs @@ -6,12 +6,16 @@ namespace MediaBrowser.Providers.Tmdb.TV { public class TmdbSeriesExternalId : IExternalId { + /// public string Name => TmdbUtils.ProviderName; + /// public string Key => MetadataProviders.Tmdb.ToString(); + /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}"; + /// public bool Supports(IHasProviderIds item) { return item is Series; diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs index 5367346e9..882ec7574 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesImageProvider.cs @@ -69,12 +69,12 @@ namespace MediaBrowser.Providers.Tmdb.TV list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo { - Url = tmdbImageUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, - Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language), + Url = tmdbImageUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, + Language = TmdbMovieProvider.AdjustImageLanguage(i.Iso_639_1, language), ProviderName = Name, Type = ImageType.Primary, RatingType = RatingType.Score @@ -82,11 +82,11 @@ namespace MediaBrowser.Providers.Tmdb.TV list.AddRange(GetBackdrops(results).Select(i => new RemoteImageInfo { - Url = tmdbImageUrl + i.file_path, - CommunityRating = i.vote_average, - VoteCount = i.vote_count, - Width = i.width, - Height = i.height, + Url = tmdbImageUrl + i.File_Path, + CommunityRating = i.Vote_Average, + VoteCount = i.Vote_Count, + Width = i.Width, + Height = i.Height, ProviderName = Name, Type = ImageType.Backdrop, RatingType = RatingType.Score @@ -123,7 +123,7 @@ namespace MediaBrowser.Providers.Tmdb.TV /// The images. private IEnumerable GetPosters(Images images) { - return images.posters ?? new List(); + return images.Posters ?? new List(); } /// @@ -132,10 +132,10 @@ namespace MediaBrowser.Providers.Tmdb.TV /// The images. private IEnumerable GetBackdrops(Images images) { - var eligibleBackdrops = images.backdrops ?? new List(); + var eligibleBackdrops = images.Backdrops ?? new List(); - return eligibleBackdrops.OrderByDescending(i => i.vote_average) - .ThenByDescending(i => i.vote_count); + return eligibleBackdrops.OrderByDescending(i => i.Vote_Average) + .ThenByDescending(i => i.Vote_Count); } /// @@ -166,7 +166,7 @@ namespace MediaBrowser.Providers.Tmdb.TV if (fileInfo.Exists) { - return jsonSerializer.DeserializeFromFile(path).images; + return jsonSerializer.DeserializeFromFile(path).Images; } } diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs index 198c68b8e..304f34c25 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesProvider.cs @@ -73,17 +73,17 @@ namespace MediaBrowser.Providers.Tmdb.TV var remoteResult = new RemoteSearchResult { - Name = obj.name, + Name = obj.Name, SearchProviderName = Name, - ImageUrl = string.IsNullOrWhiteSpace(obj.poster_path) ? null : tmdbImageUrl + obj.poster_path + ImageUrl = string.IsNullOrWhiteSpace(obj.Poster_Path) ? null : tmdbImageUrl + obj.Poster_Path }; - remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.id.ToString(_usCulture)); - remoteResult.SetProviderId(MetadataProviders.Imdb, obj.external_ids.imdb_id); + remoteResult.SetProviderId(MetadataProviders.Tmdb, obj.Id.ToString(_usCulture)); + remoteResult.SetProviderId(MetadataProviders.Imdb, obj.External_Ids.Imdb_Id); - if (obj.external_ids.tvdb_id > 0) + if (obj.External_Ids.Tvdb_Id > 0) { - remoteResult.SetProviderId(MetadataProviders.Tvdb, obj.external_ids.tvdb_id.ToString(_usCulture)); + remoteResult.SetProviderId(MetadataProviders.Tvdb, obj.External_Ids.Tvdb_Id.ToString(_usCulture)); } return new[] { remoteResult }; @@ -187,7 +187,7 @@ namespace MediaBrowser.Providers.Tmdb.TV return null; } - tmdbId = seriesInfo.id.ToString(_usCulture); + tmdbId = seriesInfo.Id.ToString(_usCulture); string dataFilePath = GetDataFilePath(tmdbId, language); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath)); @@ -210,91 +210,91 @@ namespace MediaBrowser.Providers.Tmdb.TV { var series = seriesResult.Item; - series.Name = seriesInfo.name; - series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.id.ToString(_usCulture)); + series.Name = seriesInfo.Name; + series.SetProviderId(MetadataProviders.Tmdb, seriesInfo.Id.ToString(_usCulture)); //series.VoteCount = seriesInfo.vote_count; - string voteAvg = seriesInfo.vote_average.ToString(CultureInfo.InvariantCulture); + string voteAvg = seriesInfo.Vote_Average.ToString(CultureInfo.InvariantCulture); if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out float rating)) { series.CommunityRating = rating; } - series.Overview = seriesInfo.overview; + series.Overview = seriesInfo.Overview; - if (seriesInfo.networks != null) + if (seriesInfo.Networks != null) { - series.Studios = seriesInfo.networks.Select(i => i.name).ToArray(); + series.Studios = seriesInfo.Networks.Select(i => i.Name).ToArray(); } - if (seriesInfo.genres != null) + if (seriesInfo.Genres != null) { - series.Genres = seriesInfo.genres.Select(i => i.name).ToArray(); + series.Genres = seriesInfo.Genres.Select(i => i.Name).ToArray(); } //series.HomePageUrl = seriesInfo.homepage; - series.RunTimeTicks = seriesInfo.episode_run_time.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault(); + series.RunTimeTicks = seriesInfo.Episode_Run_Time.Select(i => TimeSpan.FromMinutes(i).Ticks).FirstOrDefault(); - if (string.Equals(seriesInfo.status, "Ended", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(seriesInfo.Status, "Ended", StringComparison.OrdinalIgnoreCase)) { series.Status = SeriesStatus.Ended; - series.EndDate = seriesInfo.last_air_date; + series.EndDate = seriesInfo.Last_Air_Date; } else { series.Status = SeriesStatus.Continuing; } - series.PremiereDate = seriesInfo.first_air_date; + series.PremiereDate = seriesInfo.First_Air_Date; - var ids = seriesInfo.external_ids; + var ids = seriesInfo.External_Ids; if (ids != null) { - if (!string.IsNullOrWhiteSpace(ids.imdb_id)) + if (!string.IsNullOrWhiteSpace(ids.Imdb_Id)) { - series.SetProviderId(MetadataProviders.Imdb, ids.imdb_id); + series.SetProviderId(MetadataProviders.Imdb, ids.Imdb_Id); } - if (ids.tvrage_id > 0) + if (ids.Tvrage_Id > 0) { - series.SetProviderId(MetadataProviders.TvRage, ids.tvrage_id.ToString(_usCulture)); + series.SetProviderId(MetadataProviders.TvRage, ids.Tvrage_Id.ToString(_usCulture)); } - if (ids.tvdb_id > 0) + if (ids.Tvdb_Id > 0) { - series.SetProviderId(MetadataProviders.Tvdb, ids.tvdb_id.ToString(_usCulture)); + series.SetProviderId(MetadataProviders.Tvdb, ids.Tvdb_Id.ToString(_usCulture)); } } - var contentRatings = (seriesInfo.content_ratings ?? new ContentRatings()).results ?? new List(); + var contentRatings = (seriesInfo.Content_Ratings ?? new ContentRatings()).Results ?? new List(); - var ourRelease = contentRatings.FirstOrDefault(c => string.Equals(c.iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase)); - var usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.iso_3166_1, "US", StringComparison.OrdinalIgnoreCase)); + var ourRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, preferredCountryCode, StringComparison.OrdinalIgnoreCase)); + var usRelease = contentRatings.FirstOrDefault(c => string.Equals(c.Iso_3166_1, "US", StringComparison.OrdinalIgnoreCase)); var minimumRelease = contentRatings.FirstOrDefault(); if (ourRelease != null) { - series.OfficialRating = ourRelease.rating; + series.OfficialRating = ourRelease.Rating; } else if (usRelease != null) { - series.OfficialRating = usRelease.rating; + series.OfficialRating = usRelease.Rating; } else if (minimumRelease != null) { - series.OfficialRating = minimumRelease.rating; + series.OfficialRating = minimumRelease.Rating; } - if (seriesInfo.videos != null && seriesInfo.videos.results != null) + if (seriesInfo.Videos != null && seriesInfo.Videos.Results != null) { - foreach (var video in seriesInfo.videos.results) + foreach (var video in seriesInfo.Videos.Results) { - if ((video.type.Equals("trailer", StringComparison.OrdinalIgnoreCase) - || video.type.Equals("clip", StringComparison.OrdinalIgnoreCase)) - && video.site.Equals("youtube", StringComparison.OrdinalIgnoreCase)) + if ((video.Type.Equals("trailer", StringComparison.OrdinalIgnoreCase) + || video.Type.Equals("clip", StringComparison.OrdinalIgnoreCase)) + && video.Site.Equals("youtube", StringComparison.OrdinalIgnoreCase)) { - series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.key}"); + series.AddTrailerUrl($"http://www.youtube.com/watch?v={video.Key}"); } } } @@ -302,26 +302,26 @@ namespace MediaBrowser.Providers.Tmdb.TV seriesResult.ResetPeople(); var tmdbImageUrl = settings.images.GetImageUrl("original"); - if (seriesInfo.credits != null && seriesInfo.credits.cast != null) + if (seriesInfo.Credits != null && seriesInfo.Credits.Cast != null) { - foreach (var actor in seriesInfo.credits.cast.OrderBy(a => a.order)) + foreach (var actor in seriesInfo.Credits.Cast.OrderBy(a => a.Order)) { var personInfo = new PersonInfo { - Name = actor.name.Trim(), - Role = actor.character, + Name = actor.Name.Trim(), + Role = actor.Character, Type = PersonType.Actor, - SortOrder = actor.order + SortOrder = actor.Order }; - if (!string.IsNullOrWhiteSpace(actor.profile_path)) + if (!string.IsNullOrWhiteSpace(actor.Profile_Path)) { - personInfo.ImageUrl = tmdbImageUrl + actor.profile_path; + personInfo.ImageUrl = tmdbImageUrl + actor.Profile_Path; } - if (actor.id > 0) + if (actor.Id > 0) { - personInfo.SetProviderId(MetadataProviders.Tmdb, actor.id.ToString(CultureInfo.InvariantCulture)); + personInfo.SetProviderId(MetadataProviders.Tmdb, actor.Id.ToString(CultureInfo.InvariantCulture)); } seriesResult.AddPerson(personInfo); @@ -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 (mainResult != null && - string.IsNullOrEmpty(mainResult.overview) && + string.IsNullOrEmpty(mainResult.Overview) && !string.IsNullOrEmpty(language) && !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase)) { @@ -422,7 +422,7 @@ namespace MediaBrowser.Providers.Tmdb.TV { var englishResult = await _jsonSerializer.DeserializeFromStreamAsync(json).ConfigureAwait(false); - mainResult.overview = englishResult.overview; + mainResult.Overview = englishResult.Overview; mainResult.ResultLanguage = "en"; } } @@ -487,9 +487,9 @@ namespace MediaBrowser.Providers.Tmdb.TV { var result = await _jsonSerializer.DeserializeFromStreamAsync(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) { @@ -498,12 +498,12 @@ namespace MediaBrowser.Providers.Tmdb.TV var remoteResult = new RemoteSearchResult { - Name = tv.name, + Name = tv.Name, SearchProviderName = Name, - ImageUrl = string.IsNullOrWhiteSpace(tv.poster_path) ? null : tmdbImageUrl + tv.poster_path + ImageUrl = string.IsNullOrWhiteSpace(tv.Poster_Path) ? null : tmdbImageUrl + tv.Poster_Path }; - remoteResult.SetProviderId(MetadataProviders.Tmdb, tv.id.ToString(_usCulture)); + remoteResult.SetProviderId(MetadataProviders.Tmdb, tv.Id.ToString(_usCulture)); return remoteResult; } diff --git a/MediaBrowser.Providers/Tmdb/TmdbUtils.cs b/MediaBrowser.Providers/Tmdb/TmdbUtils.cs index ada6860fe..035b99c1a 100644 --- a/MediaBrowser.Providers/Tmdb/TmdbUtils.cs +++ b/MediaBrowser.Providers/Tmdb/TmdbUtils.cs @@ -14,13 +14,13 @@ namespace MediaBrowser.Providers.Tmdb public static string MapCrewToPersonType(Crew crew) { - if (crew.department.Equals("production", StringComparison.InvariantCultureIgnoreCase) - && crew.job.IndexOf("producer", StringComparison.InvariantCultureIgnoreCase) != -1) + if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase) + && crew.Job.IndexOf("producer", StringComparison.InvariantCultureIgnoreCase) != -1) { return PersonType.Producer; } - if (crew.department.Equals("writing", StringComparison.InvariantCultureIgnoreCase)) + if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase)) { return PersonType.Writer; }