Move and rename tmdb providers for better separation
This commit is contained in:
parent
25a590e8cd
commit
817d9b3389
|
@ -7,85 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
{
|
||||
public class MovieDbMovieExternalId : IExternalId
|
||||
{
|
||||
public const string BaseMovieDbUrl = "https://www.themoviedb.org/";
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => BaseMovieDbUrl + "movie/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
// Supports images for tv movies
|
||||
var tvProgram = item as LiveTvProgram;
|
||||
if (tvProgram != null && tvProgram.IsMovie)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return item is Movie || item is MusicVideo || item is Trailer;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbSeriesExternalId : IExternalId
|
||||
{
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "tv/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Series;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbMovieCollectionExternalId : IExternalId
|
||||
{
|
||||
public string Name => "TheMovieDb Collection";
|
||||
|
||||
public string Key => MetadataProviders.TmdbCollection.ToString();
|
||||
|
||||
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Movie || item is MusicVideo || item is Trailer;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbPersonExternalId : IExternalId
|
||||
{
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "person/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Person;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbCollectionExternalId : IExternalId
|
||||
{
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is BoxSet;
|
||||
}
|
||||
}
|
||||
|
||||
public class ImdbExternalId : IExternalId
|
||||
{
|
||||
public string Name => "IMDb";
|
||||
|
|
21
MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs
Normal file
21
MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.BoxSets
|
||||
{
|
||||
public class TmdbBoxSetExternalId : IExternalId
|
||||
{
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public string Key => MetadataProviders.TmdbCollection.ToString();
|
||||
|
||||
public string UrlFormatString => TmdbUtils.BaseMovieDbUrl + "collection/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Movie || item is MusicVideo || item is Trailer;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,21 +11,24 @@ using MediaBrowser.Model.Dto;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Collections;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.BoxSets
|
||||
namespace MediaBrowser.Providers.Tmdb.BoxSets
|
||||
{
|
||||
public class MovieDbBoxSetImageProvider : IRemoteImageProvider, IHasOrder
|
||||
public class TmdbBoxSetImageProvider : IRemoteImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
public MovieDbBoxSetImageProvider(IHttpClient httpClient)
|
||||
public TmdbBoxSetImageProvider(IHttpClient httpClient)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public string Name => ProviderName;
|
||||
|
||||
public static string ProviderName => "TheMovieDb";
|
||||
public static string ProviderName => TmdbUtils.ProviderName;
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
|
@ -49,11 +52,11 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
{
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
var mainResult = await MovieDbBoxSetProvider.Current.GetMovieDbResult(tmdbId, null, cancellationToken).ConfigureAwait(false);
|
||||
var mainResult = await TmdbBoxSetProvider.Current.GetMovieDbResult(tmdbId, null, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (mainResult != null)
|
||||
{
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -64,11 +67,11 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
return new List<RemoteImageInfo>();
|
||||
}
|
||||
|
||||
private IEnumerable<RemoteImageInfo> GetImages(MovieDbBoxSetProvider.RootObject obj, string language, string baseUrl)
|
||||
private IEnumerable<RemoteImageInfo> GetImages(CollectionResult obj, string language, string baseUrl)
|
||||
{
|
||||
var list = new List<RemoteImageInfo>();
|
||||
|
||||
var images = obj.images ?? new MovieDbBoxSetProvider.Images();
|
||||
var images = obj.images ?? new CollectionImages();
|
||||
|
||||
list.AddRange(GetPosters(images).Select(i => new RemoteImageInfo
|
||||
{
|
||||
|
@ -77,7 +80,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
|
@ -125,9 +128,9 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns>IEnumerable{MovieDbProvider.Poster}.</returns>
|
||||
private IEnumerable<MovieDbBoxSetProvider.Poster> GetPosters(MovieDbBoxSetProvider.Images images)
|
||||
private IEnumerable<Poster> GetPosters(CollectionImages images)
|
||||
{
|
||||
return images.posters ?? new List<MovieDbBoxSetProvider.Poster>();
|
||||
return images.posters ?? new List<Poster>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -135,9 +138,9 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns>
|
||||
private IEnumerable<MovieDbBoxSetProvider.Backdrop> GetBackdrops(MovieDbBoxSetProvider.Images images)
|
||||
private IEnumerable<Backdrop> GetBackdrops(CollectionImages images)
|
||||
{
|
||||
var eligibleBackdrops = images.backdrops == null ? new List<MovieDbBoxSetProvider.Backdrop>() :
|
||||
var eligibleBackdrops = images.backdrops == null ? new List<Backdrop>() :
|
||||
images.backdrops;
|
||||
|
||||
return eligibleBackdrops.OrderByDescending(i => i.vote_average)
|
|
@ -16,16 +16,18 @@ using MediaBrowser.Model.Globalization;
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Collections;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.BoxSets
|
||||
namespace MediaBrowser.Providers.Tmdb.BoxSets
|
||||
{
|
||||
public class MovieDbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
||||
public class TmdbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
||||
{
|
||||
private const string GetCollectionInfo3 = MovieDbProvider.BaseMovieDbUrl + @"3/collection/{0}?api_key={1}&append_to_response=images";
|
||||
private const string GetCollectionInfo3 = TmdbUtils.BaseMovieDbUrl + @"3/collection/{0}?api_key={1}&append_to_response=images";
|
||||
|
||||
internal static MovieDbBoxSetProvider Current;
|
||||
internal static TmdbBoxSetProvider Current;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IJsonSerializer _json;
|
||||
|
@ -35,7 +37,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public MovieDbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
||||
public TmdbBoxSetProvider(ILogger logger, IJsonSerializer json, IServerConfigurationManager config, IFileSystem fileSystem, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_json = json;
|
||||
|
@ -58,11 +60,11 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
await EnsureInfo(tmdbId, searchInfo.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, searchInfo.MetadataLanguage);
|
||||
var info = _json.DeserializeFromFile<RootObject>(dataFilePath);
|
||||
var info = _json.DeserializeFromFile<CollectionResult>(dataFilePath);
|
||||
|
||||
var images = (info.images ?? new Images()).posters ?? new List<Poster>();
|
||||
var images = (info.images ?? new CollectionImages()).posters ?? new List<Poster>();
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -80,7 +82,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
return new[] { result };
|
||||
}
|
||||
|
||||
return await new MovieDbSearch(_logger, _json, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
return await new TmdbSearch(_logger, _json, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<MetadataResult<BoxSet>> GetMetadata(BoxSetInfo id, CancellationToken cancellationToken)
|
||||
|
@ -90,7 +92,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
// We don't already have an Id, need to fetch it
|
||||
if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
var searchResults = await new MovieDbSearch(_logger, _json, _libraryManager).GetSearchResults(id, cancellationToken).ConfigureAwait(false);
|
||||
var searchResults = await new TmdbSearch(_logger, _json, _libraryManager).GetSearchResults(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var searchResult = searchResults.FirstOrDefault();
|
||||
|
||||
|
@ -116,7 +118,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
return result;
|
||||
}
|
||||
|
||||
internal async Task<RootObject> GetMovieDbResult(string tmdbId, string language, CancellationToken cancellationToken)
|
||||
internal async Task<CollectionResult> GetMovieDbResult(string tmdbId, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
|
@ -129,13 +131,13 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
|
||||
if (!string.IsNullOrEmpty(dataFilePath))
|
||||
{
|
||||
return _json.DeserializeFromFile<RootObject>(dataFilePath);
|
||||
return _json.DeserializeFromFile<CollectionResult>(dataFilePath);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private BoxSet GetItem(RootObject obj)
|
||||
private BoxSet GetItem(CollectionResult obj)
|
||||
{
|
||||
var item = new BoxSet
|
||||
{
|
||||
|
@ -161,33 +163,33 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
_json.SerializeToFile(mainResult, dataFilePath);
|
||||
}
|
||||
|
||||
private async Task<RootObject> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
||||
private async Task<CollectionResult> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(GetCollectionInfo3, id, MovieDbProvider.ApiKey);
|
||||
var url = string.Format(GetCollectionInfo3, id, TmdbUtils.ApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
url += string.Format("&language={0}", MovieDbProvider.NormalizeLanguage(language));
|
||||
url += string.Format("&language={0}", TmdbMovieProvider.NormalizeLanguage(language));
|
||||
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
||||
url += "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language);
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
RootObject mainResult = null;
|
||||
CollectionResult mainResult;
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbSearch.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
mainResult = await _json.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
mainResult = await _json.DeserializeFromStreamAsync<CollectionResult>(json).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,25 +199,25 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
{
|
||||
if (!string.IsNullOrEmpty(language) && !string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
url = string.Format(GetCollectionInfo3, id, MovieDbSearch.ApiKey) + "&language=en";
|
||||
url = string.Format(GetCollectionInfo3, id, TmdbUtils.ApiKey) + "&language=en";
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
||||
url += "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language);
|
||||
}
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbSearch.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
mainResult = await _json.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
mainResult = await _json.DeserializeFromStreamAsync<CollectionResult>(json).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +243,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
return DownloadInfo(tmdbId, preferredMetadataLanguage, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
private static string GetDataFilePath(IApplicationPaths appPaths, string tmdbId, string preferredLanguage)
|
||||
{
|
||||
|
@ -266,54 +268,6 @@ namespace MediaBrowser.Providers.BoxSets
|
|||
return dataPath;
|
||||
}
|
||||
|
||||
internal 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; }
|
||||
}
|
||||
|
||||
internal 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; }
|
||||
}
|
||||
|
||||
internal 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; }
|
||||
}
|
||||
|
||||
internal class Images
|
||||
{
|
||||
public List<Backdrop> backdrops { get; set; }
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
|
||||
internal class RootObject
|
||||
{
|
||||
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<Part> parts { get; set; }
|
||||
public Images images { get; set; }
|
||||
}
|
||||
|
||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||
{
|
||||
return _httpClient.GetResponse(new HttpRequestOptions
|
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Collections
|
||||
{
|
||||
public class CollectionImages
|
||||
{
|
||||
public List<Backdrop> backdrops { get; set; }
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
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<Part> parts { get; set; }
|
||||
public CollectionImages images { get; set; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/Collections/Part.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
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; }
|
||||
}
|
||||
}
|
13
MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs
Normal file
13
MediaBrowser.Providers/Tmdb/Models/General/Backdrop.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
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; }
|
||||
}
|
||||
}
|
12
MediaBrowser.Providers/Tmdb/Models/General/Crew.cs
Normal file
12
MediaBrowser.Providers/Tmdb/Models/General/Crew.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
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; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/General/ExternalIds.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
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; }
|
||||
}
|
||||
}
|
8
MediaBrowser.Providers/Tmdb/Models/General/Genre.cs
Normal file
8
MediaBrowser.Providers/Tmdb/Models/General/Genre.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class Genre
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
10
MediaBrowser.Providers/Tmdb/Models/General/Images.cs
Normal file
10
MediaBrowser.Providers/Tmdb/Models/General/Images.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class Images
|
||||
{
|
||||
public List<Backdrop> backdrops { get; set; }
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
}
|
8
MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs
Normal file
8
MediaBrowser.Providers/Tmdb/Models/General/Keyword.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class Keyword
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/General/Keywords.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class Keywords
|
||||
{
|
||||
public List<Keyword> results { get; set; }
|
||||
}
|
||||
}
|
13
MediaBrowser.Providers/Tmdb/Models/General/Poster.cs
Normal file
13
MediaBrowser.Providers/Tmdb/Models/General/Poster.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
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; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/General/Profile.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/General/Profile.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
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; }
|
||||
}
|
||||
}
|
14
MediaBrowser.Providers/Tmdb/Models/General/Still.cs
Normal file
14
MediaBrowser.Providers/Tmdb/Models/General/Still.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
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; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class StillImages
|
||||
{
|
||||
public List<Still> stills { get; set; }
|
||||
}
|
||||
}
|
14
MediaBrowser.Providers/Tmdb/Models/General/Video.cs
Normal file
14
MediaBrowser.Providers/Tmdb/Models/General/Video.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
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; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/General/Videos.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/General/Videos.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.General
|
||||
{
|
||||
public class Videos
|
||||
{
|
||||
public List<Video> results { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class BelongsToCollection
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
}
|
||||
}
|
12
MediaBrowser.Providers/Tmdb/Models/Movies/Cast.cs
Normal file
12
MediaBrowser.Providers/Tmdb/Models/Movies/Cast.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Cast
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string character { get; set; }
|
||||
public int order { get; set; }
|
||||
public int cast_id { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/Movies/Casts.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/Movies/Casts.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Casts
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/Movies/Country.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/Movies/Country.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Country
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string certification { get; set; }
|
||||
public DateTime release_date { get; set; }
|
||||
}
|
||||
}
|
49
MediaBrowser.Providers/Tmdb/Models/Movies/MovieResult.cs
Normal file
49
MediaBrowser.Providers/Tmdb/Models/Movies/MovieResult.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class MovieResult
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public BelongsToCollection belongs_to_collection { get; set; }
|
||||
public int budget { get; set; }
|
||||
public List<Genre> genres { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public string imdb_id { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string original_name { get; set; }
|
||||
public string overview { get; set; }
|
||||
public double popularity { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public List<ProductionCompany> production_companies { get; set; }
|
||||
public List<ProductionCountry> production_countries { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public int revenue { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public List<SpokenLanguage> spoken_languages { get; set; }
|
||||
public string status { get; set; }
|
||||
public string tagline { get; set; }
|
||||
public string title { get; set; }
|
||||
public string name { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public Casts casts { get; set; }
|
||||
public Releases releases { get; set; }
|
||||
public Images images { get; set; }
|
||||
public Keywords keywords { get; set; }
|
||||
public Trailers trailers { get; set; }
|
||||
|
||||
public string GetOriginalTitle()
|
||||
{
|
||||
return original_name ?? original_title;
|
||||
}
|
||||
|
||||
public string GetTitle()
|
||||
{
|
||||
return name ?? title ?? GetOriginalTitle();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class ProductionCompany
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int id { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class ProductionCountry
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/Movies/Releases.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/Movies/Releases.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Releases
|
||||
{
|
||||
public List<Country> countries { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class SpokenLanguage
|
||||
{
|
||||
public string iso_639_1 { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/Movies/Trailers.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/Movies/Trailers.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Trailers
|
||||
{
|
||||
public List<Youtube> youtube { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/Movies/Youtube.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/Movies/Youtube.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Movies
|
||||
{
|
||||
public class Youtube
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string size { get; set; }
|
||||
public string source { get; set; }
|
||||
}
|
||||
}
|
10
MediaBrowser.Providers/Tmdb/Models/People/PersonImages.cs
Normal file
10
MediaBrowser.Providers/Tmdb/Models/People/PersonImages.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.People
|
||||
{
|
||||
public class PersonImages
|
||||
{
|
||||
public List<Profile> profiles { get; set; }
|
||||
}
|
||||
}
|
23
MediaBrowser.Providers/Tmdb/Models/People/PersonResult.cs
Normal file
23
MediaBrowser.Providers/Tmdb/Models/People/PersonResult.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.People
|
||||
{
|
||||
public class PersonResult
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public List<string> also_known_as { get; set; }
|
||||
public string biography { get; set; }
|
||||
public string birthday { get; set; }
|
||||
public string deathday { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public string imdb_id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string place_of_birth { get; set; }
|
||||
public double popularity { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public PersonImages images { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.People
|
||||
{
|
||||
public class PersonSearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="PersonSearchResult" /> is adult.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
|
||||
public bool Adult { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the profile_ path.
|
||||
/// </summary>
|
||||
/// <value>The profile_ path.</value>
|
||||
public string Profile_Path { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Search
|
||||
{
|
||||
public class ExternalIdLookupResult
|
||||
{
|
||||
public List<TvResult> tv_results { get; set; }
|
||||
}
|
||||
}
|
65
MediaBrowser.Providers/Tmdb/Models/Search/MovieResult.cs
Normal file
65
MediaBrowser.Providers/Tmdb/Models/Search/MovieResult.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.Search
|
||||
{
|
||||
public class MovieResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="TmdbMovieSearchResult" /> is adult.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
|
||||
public bool adult { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the backdrop_path.
|
||||
/// </summary>
|
||||
/// <value>The backdrop_path.</value>
|
||||
public string backdrop_path { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the original_title.
|
||||
/// </summary>
|
||||
/// <value>The original_title.</value>
|
||||
public string original_title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the original_name.
|
||||
/// </summary>
|
||||
/// <value>The original_name.</value>
|
||||
public string original_name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the release_date.
|
||||
/// </summary>
|
||||
/// <value>The release_date.</value>
|
||||
public string release_date { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the poster_path.
|
||||
/// </summary>
|
||||
/// <value>The poster_path.</value>
|
||||
public string poster_path { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the popularity.
|
||||
/// </summary>
|
||||
/// <value>The popularity.</value>
|
||||
public double popularity { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the vote_average.
|
||||
/// </summary>
|
||||
/// <value>The vote_average.</value>
|
||||
public double vote_average { get; set; }
|
||||
/// <summary>
|
||||
/// For collection search results
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the vote_count.
|
||||
/// </summary>
|
||||
/// <value>The vote_count.</value>
|
||||
public int vote_count { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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; }
|
||||
}
|
||||
}
|
15
MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs
Normal file
15
MediaBrowser.Providers/Tmdb/Models/Search/TvResult.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
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; }
|
||||
}
|
||||
}
|
28
MediaBrowser.Providers/Tmdb/Models/Search/TvSearchResults.cs
Normal file
28
MediaBrowser.Providers/Tmdb/Models/Search/TvSearchResults.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.Search
|
||||
{
|
||||
public class TvSearchResults
|
||||
{
|
||||
/// <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<TvResult> 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; }
|
||||
}
|
||||
}
|
12
MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs
Normal file
12
MediaBrowser.Providers/Tmdb/Models/TV/Cast.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
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; }
|
||||
}
|
||||
}
|
8
MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs
Normal file
8
MediaBrowser.Providers/Tmdb/Models/TV/ContentRating.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class ContentRating
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string rating { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/TV/ContentRatings.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class ContentRatings
|
||||
{
|
||||
public List<ContentRating> results { get; set; }
|
||||
}
|
||||
}
|
9
MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs
Normal file
9
MediaBrowser.Providers/Tmdb/Models/TV/CreatedBy.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
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; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/TV/Credits.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
}
|
14
MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs
Normal file
14
MediaBrowser.Providers/Tmdb/Models/TV/Episode.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
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; }
|
||||
}
|
||||
}
|
12
MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs
Normal file
12
MediaBrowser.Providers/Tmdb/Models/TV/EpisodeCredits.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class EpisodeCredits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
public List<GuestStar> guest_stars { get; set; }
|
||||
}
|
||||
}
|
23
MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs
Normal file
23
MediaBrowser.Providers/Tmdb/Models/TV/EpisodeResult.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
12
MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs
Normal file
12
MediaBrowser.Providers/Tmdb/Models/TV/GuestStar.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
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; }
|
||||
}
|
||||
}
|
8
MediaBrowser.Providers/Tmdb/Models/TV/Network.cs
Normal file
8
MediaBrowser.Providers/Tmdb/Models/TV/Network.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class Network
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
11
MediaBrowser.Providers/Tmdb/Models/TV/Season.cs
Normal file
11
MediaBrowser.Providers/Tmdb/Models/TV/Season.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
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; }
|
||||
}
|
||||
}
|
10
MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs
Normal file
10
MediaBrowser.Providers/Tmdb/Models/TV/SeasonImages.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class SeasonImages
|
||||
{
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
}
|
21
MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs
Normal file
21
MediaBrowser.Providers/Tmdb/Models/TV/SeasonResult.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class SeasonResult
|
||||
{
|
||||
public DateTime air_date { get; set; }
|
||||
public List<Episode> 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; }
|
||||
}
|
||||
}
|
40
MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs
Normal file
40
MediaBrowser.Providers/Tmdb/Models/TV/SeriesResult.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Models.TV
|
||||
{
|
||||
public class SeriesResult
|
||||
{
|
||||
public string backdrop_path { get; set; }
|
||||
public List<CreatedBy> created_by { get; set; }
|
||||
public List<int> episode_run_time { get; set; }
|
||||
public DateTime first_air_date { get; set; }
|
||||
public List<Genre> genres { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public bool in_production { get; set; }
|
||||
public List<string> languages { get; set; }
|
||||
public DateTime last_air_date { get; set; }
|
||||
public string name { get; set; }
|
||||
public List<Network> networks { get; set; }
|
||||
public int number_of_episodes { get; set; }
|
||||
public int number_of_seasons { get; set; }
|
||||
public string original_name { get; set; }
|
||||
public List<string> origin_country { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string popularity { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public List<Season> seasons { get; set; }
|
||||
public string status { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public Credits credits { get; set; }
|
||||
public Images images { get; set; }
|
||||
public Keywords keywords { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
public General.Videos videos { get; set; }
|
||||
public ContentRatings content_ratings { get; set; }
|
||||
public string ResultLanguage { get; set; }
|
||||
}
|
||||
}
|
|
@ -14,11 +14,13 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
public class GenericMovieDbInfo<T>
|
||||
public class GenericTmdbMovieInfo<T>
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
@ -28,7 +30,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem)
|
||||
public GenericTmdbMovieInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem)
|
||||
{
|
||||
_logger = logger;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
@ -44,7 +46,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
// Don't search for music video id's because it is very easy to misidentify.
|
||||
if (string.IsNullOrEmpty(tmdbId) && string.IsNullOrEmpty(imdbId) && typeof(T) != typeof(MusicVideo))
|
||||
{
|
||||
var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(itemId, cancellationToken).ConfigureAwait(false);
|
||||
var searchResults = await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(itemId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var searchResult = searchResults.FirstOrDefault();
|
||||
|
||||
|
@ -81,17 +83,17 @@ namespace MediaBrowser.Providers.Movies
|
|||
};
|
||||
|
||||
string dataFilePath = null;
|
||||
MovieDbProvider.CompleteMovieData movieInfo = null;
|
||||
MovieResult movieInfo = null;
|
||||
|
||||
// Id could be ImdbId or TmdbId
|
||||
if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
movieInfo = await MovieDbProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
|
||||
movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
|
||||
if (movieInfo != null)
|
||||
{
|
||||
tmdbId = movieInfo.id.ToString(_usCulture);
|
||||
|
||||
dataFilePath = MovieDbProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
dataFilePath = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
|
||||
_jsonSerializer.SerializeToFile(movieInfo, dataFilePath);
|
||||
}
|
||||
|
@ -99,12 +101,12 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(tmdbId))
|
||||
{
|
||||
await MovieDbProvider.Current.EnsureMovieInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
await TmdbMovieProvider.Current.EnsureMovieInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
dataFilePath = dataFilePath ?? MovieDbProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
movieInfo = movieInfo ?? _jsonSerializer.DeserializeFromFile<MovieDbProvider.CompleteMovieData>(dataFilePath);
|
||||
dataFilePath = dataFilePath ?? TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
movieInfo = movieInfo ?? _jsonSerializer.DeserializeFromFile<MovieResult>(dataFilePath);
|
||||
|
||||
var settings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var settings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
ProcessMainInfo(item, settings, preferredCountryCode, movieInfo);
|
||||
item.HasMetadata = true;
|
||||
|
@ -120,7 +122,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// <param name="settings">The settings.</param>
|
||||
/// <param name="preferredCountryCode">The preferred country code.</param>
|
||||
/// <param name="movieData">The movie data.</param>
|
||||
private void ProcessMainInfo(MetadataResult<T> resultItem, TmdbSettingsResult settings, string preferredCountryCode, MovieDbProvider.CompleteMovieData movieData)
|
||||
private void ProcessMainInfo(MetadataResult<T> resultItem, TmdbSettingsResult settings, string preferredCountryCode, MovieResult movieData)
|
||||
{
|
||||
var movie = resultItem.Item;
|
||||
|
||||
|
@ -154,9 +156,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
movie.SetProviderId(MetadataProviders.TmdbCollection,
|
||||
movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
var movieItem = movie as Movie;
|
||||
|
||||
if (movieItem != null)
|
||||
if (movie is Movie movieItem)
|
||||
{
|
||||
movieItem.CollectionName = movieData.belongs_to_collection.name;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
// genres
|
||||
// Movies get this from imdb
|
||||
var genres = movieData.genres ?? new List<MovieDbProvider.GenreItem>();
|
||||
var genres = movieData.genres ?? new List<Tmdb.Models.General.Genre>();
|
||||
|
||||
foreach (var genre in genres.Select(g => g.name))
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
}
|
||||
|
||||
//and the rest from crew
|
||||
if (movieData.casts != null && movieData.casts.crew != null)
|
||||
if (movieData.casts?.crew != null)
|
||||
{
|
||||
var keepTypes = new[]
|
||||
{
|
|
@ -13,16 +13,19 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
public class MovieDbImageProvider : IRemoteImageProvider, IHasOrder
|
||||
public class TmdbImageProvider : IRemoteImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public MovieDbImageProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem)
|
||||
public TmdbImageProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClient = httpClient;
|
||||
|
@ -31,7 +34,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
public string Name => ProviderName;
|
||||
|
||||
public static string ProviderName => "TheMovieDb";
|
||||
public static string ProviderName => TmdbUtils.ProviderName;
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
|
@ -60,7 +63,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
return list;
|
||||
}
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -75,7 +78,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
|
@ -127,9 +130,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns>IEnumerable{MovieDbProvider.Poster}.</returns>
|
||||
private IEnumerable<MovieDbProvider.Poster> GetPosters(MovieDbProvider.Images images)
|
||||
private IEnumerable<Poster> GetPosters(Images images)
|
||||
{
|
||||
return images.posters ?? new List<MovieDbProvider.Poster>();
|
||||
return images.posters ?? new List<Poster>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -137,9 +140,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns>IEnumerable{MovieDbProvider.Backdrop}.</returns>
|
||||
private IEnumerable<MovieDbProvider.Backdrop> GetBackdrops(MovieDbProvider.Images images)
|
||||
private IEnumerable<Backdrop> GetBackdrops(Images images)
|
||||
{
|
||||
var eligibleBackdrops = images.backdrops == null ? new List<MovieDbProvider.Backdrop>() :
|
||||
var eligibleBackdrops = images.backdrops == null ? new List<Backdrop>() :
|
||||
images.backdrops;
|
||||
|
||||
return eligibleBackdrops.OrderByDescending(i => i.vote_average)
|
||||
|
@ -154,7 +157,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{MovieImages}.</returns>
|
||||
private async Task<MovieDbProvider.Images> FetchImages(BaseItem item, string language, IJsonSerializer jsonSerializer, CancellationToken cancellationToken)
|
||||
private async Task<Images> FetchImages(BaseItem item, string language, IJsonSerializer jsonSerializer, CancellationToken cancellationToken)
|
||||
{
|
||||
var tmdbId = item.GetProviderId(MetadataProviders.Tmdb);
|
||||
|
||||
|
@ -163,7 +166,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
||||
if (!string.IsNullOrWhiteSpace(imdbId))
|
||||
{
|
||||
var movieInfo = await MovieDbProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
|
||||
var movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
|
||||
if (movieInfo != null)
|
||||
{
|
||||
tmdbId = movieInfo.id.ToString(CultureInfo.InvariantCulture);
|
||||
|
@ -176,9 +179,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
return null;
|
||||
}
|
||||
|
||||
await MovieDbProvider.Current.EnsureMovieInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
await TmdbMovieProvider.Current.EnsureMovieInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var path = MovieDbProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
var path = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
@ -186,7 +189,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
return jsonSerializer.DeserializeFromFile<MovieDbProvider.CompleteMovieData>(path).images;
|
||||
return jsonSerializer.DeserializeFromFile<MovieResult>(path).images;
|
||||
}
|
||||
}
|
||||
|
28
MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs
Normal file
28
MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
public class TmdbMovieExternalId : IExternalId
|
||||
{
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => TmdbUtils.BaseMovieDbUrl + "movie/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
// Supports images for tv movies
|
||||
if (item is LiveTvProgram tvProgram && tvProgram.IsMovie)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return item is Movie || item is MusicVideo || item is Trailer;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,16 +19,18 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MovieDbProvider
|
||||
/// </summary>
|
||||
public class MovieDbProvider : IRemoteMetadataProvider<Movie, MovieInfo>, IHasOrder
|
||||
public class TmdbMovieProvider : IRemoteMetadataProvider<Movie, MovieInfo>, IHasOrder
|
||||
{
|
||||
internal static MovieDbProvider Current { get; private set; }
|
||||
internal static TmdbMovieProvider Current { get; private set; }
|
||||
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
@ -41,7 +43,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
public MovieDbProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, ILibraryManager libraryManager, IApplicationHost appHost)
|
||||
public TmdbMovieProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, ILibraryManager libraryManager, IApplicationHost appHost)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClient = httpClient;
|
||||
|
@ -71,7 +73,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
var dataFilePath = GetDataFilePath(tmdbId, searchInfo.MetadataLanguage);
|
||||
|
||||
var obj = _jsonSerializer.DeserializeFromFile<CompleteMovieData>(dataFilePath);
|
||||
var obj = _jsonSerializer.DeserializeFromFile<MovieResult>(dataFilePath);
|
||||
|
||||
var tmdbSettings = await GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
@ -104,7 +106,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
return new[] { remoteResult };
|
||||
}
|
||||
|
||||
return await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
return await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
|
||||
|
@ -115,12 +117,12 @@ namespace MediaBrowser.Providers.Movies
|
|||
public Task<MetadataResult<T>> GetItemMetadata<T>(ItemLookupInfo id, CancellationToken cancellationToken)
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
var movieDb = new GenericMovieDbInfo<T>(_logger, _jsonSerializer, _libraryManager, _fileSystem);
|
||||
var movieDb = new GenericTmdbMovieInfo<T>(_logger, _jsonSerializer, _libraryManager, _fileSystem);
|
||||
|
||||
return movieDb.GetMetadata(id, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
/// <summary>
|
||||
/// The _TMDB settings task
|
||||
|
@ -140,9 +142,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
|
||||
using (HttpResponseInfo response = await GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = string.Format(TmdbConfigUrl, ApiKey),
|
||||
Url = string.Format(TmdbConfigUrl, TmdbUtils.ApiKey),
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
|
@ -155,13 +157,8 @@ namespace MediaBrowser.Providers.Movies
|
|||
}
|
||||
}
|
||||
|
||||
public const string BaseMovieDbUrl = "https://api.themoviedb.org/";
|
||||
|
||||
private const string TmdbConfigUrl = BaseMovieDbUrl + "3/configuration?api_key={0}";
|
||||
private const string GetMovieInfo3 = BaseMovieDbUrl + @"3/movie/{0}?api_key={1}&append_to_response=casts,releases,images,keywords,trailers";
|
||||
|
||||
internal static string ApiKey = "4219e299c89411838049ab0dab19ebd5";
|
||||
internal static string AcceptHeader = "application/json,image/*";
|
||||
private const string TmdbConfigUrl = TmdbUtils.BaseMovieDbUrl + "3/configuration?api_key={0}";
|
||||
private const string GetMovieInfo3 = TmdbUtils.BaseMovieDbUrl + @"3/movie/{0}?api_key={1}&append_to_response=casts,releases,images,keywords,trailers";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movie data path.
|
||||
|
@ -314,9 +311,9 @@ namespace MediaBrowser.Providers.Movies
|
|||
/// <param name="language">The language.</param>
|
||||
/// <param name="cancellationToken">The cancellation token</param>
|
||||
/// <returns>Task{CompleteMovieData}.</returns>
|
||||
internal async Task<CompleteMovieData> FetchMainResult(string id, bool isTmdbId, string language, CancellationToken cancellationToken)
|
||||
internal async Task<MovieResult> FetchMainResult(string id, bool isTmdbId, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(GetMovieInfo3, id, ApiKey);
|
||||
var url = string.Format(GetMovieInfo3, id, TmdbUtils.ApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
|
@ -326,7 +323,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
url += "&include_image_language=" + GetImageLanguagesParam(language);
|
||||
}
|
||||
|
||||
CompleteMovieData mainResult;
|
||||
MovieResult mainResult;
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
|
@ -340,7 +337,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = AcceptHeader,
|
||||
AcceptHeader = TmdbUtils.AcceptHeader,
|
||||
CacheMode = cacheMode,
|
||||
CacheLength = cacheLength
|
||||
|
||||
|
@ -348,7 +345,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
mainResult = await _jsonSerializer.DeserializeFromStreamAsync<CompleteMovieData>(json).ConfigureAwait(false);
|
||||
mainResult = await _jsonSerializer.DeserializeFromStreamAsync<MovieResult>(json).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,7 +370,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
_logger.LogInformation("MovieDbProvider couldn't find meta for language " + language + ". Trying English...");
|
||||
|
||||
url = string.Format(GetMovieInfo3, id, ApiKey) + "&language=en";
|
||||
url = string.Format(GetMovieInfo3, id, TmdbUtils.ApiKey) + "&language=en";
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
|
@ -385,7 +382,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = AcceptHeader,
|
||||
AcceptHeader = TmdbUtils.AcceptHeader,
|
||||
CacheMode = cacheMode,
|
||||
CacheLength = cacheLength
|
||||
|
||||
|
@ -393,7 +390,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<CompleteMovieData>(json).ConfigureAwait(false);
|
||||
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<MovieResult>(json).ConfigureAwait(false);
|
||||
|
||||
mainResult.overview = englishResult.overview;
|
||||
}
|
||||
|
@ -429,205 +426,6 @@ namespace MediaBrowser.Providers.Movies
|
|||
return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class TmdbTitle
|
||||
/// </summary>
|
||||
internal class TmdbTitle
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the iso_3166_1.
|
||||
/// </summary>
|
||||
/// <value>The iso_3166_1.</value>
|
||||
public string iso_3166_1 { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string title { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class TmdbAltTitleResults
|
||||
/// </summary>
|
||||
internal class TmdbAltTitleResults
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the titles.
|
||||
/// </summary>
|
||||
/// <value>The titles.</value>
|
||||
public List<TmdbTitle> titles { get; set; }
|
||||
}
|
||||
|
||||
internal class BelongsToCollection
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
}
|
||||
|
||||
internal class GenreItem
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
internal class ProductionCompany
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int id { get; set; }
|
||||
}
|
||||
|
||||
internal class ProductionCountry
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
internal class SpokenLanguage
|
||||
{
|
||||
public string iso_639_1 { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
internal class Cast
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string character { get; set; }
|
||||
public int order { get; set; }
|
||||
public int cast_id { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
internal class Crew
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string department { get; set; }
|
||||
public string job { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
internal class Casts
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
|
||||
internal class Country
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string certification { get; set; }
|
||||
public DateTime release_date { get; set; }
|
||||
}
|
||||
|
||||
internal class Releases
|
||||
{
|
||||
public List<Country> countries { get; set; }
|
||||
}
|
||||
|
||||
internal class Backdrop
|
||||
{
|
||||
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 double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
}
|
||||
|
||||
internal class Poster
|
||||
{
|
||||
public string file_path { get; set; }
|
||||
public int width { get; set; }
|
||||
public int height { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public double aspect_ratio { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
}
|
||||
|
||||
internal class Images
|
||||
{
|
||||
public List<Backdrop> backdrops { get; set; }
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
|
||||
internal class Keyword
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
internal class Keywords
|
||||
{
|
||||
public List<Keyword> keywords { get; set; }
|
||||
}
|
||||
|
||||
internal class Youtube
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string size { get; set; }
|
||||
public string source { get; set; }
|
||||
}
|
||||
|
||||
internal class Trailers
|
||||
{
|
||||
public List<object> quicktime { get; set; }
|
||||
public List<Youtube> youtube { get; set; }
|
||||
}
|
||||
|
||||
internal class CompleteMovieData
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public BelongsToCollection belongs_to_collection { get; set; }
|
||||
public int budget { get; set; }
|
||||
public List<GenreItem> genres { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public string imdb_id { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string original_name { get; set; }
|
||||
public string overview { get; set; }
|
||||
public double popularity { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public List<ProductionCompany> production_companies { get; set; }
|
||||
public List<ProductionCountry> production_countries { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public int revenue { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public List<SpokenLanguage> spoken_languages { get; set; }
|
||||
public string status { get; set; }
|
||||
public string tagline { get; set; }
|
||||
public string title { get; set; }
|
||||
public string name { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public Casts casts { get; set; }
|
||||
public Releases releases { get; set; }
|
||||
public Images images { get; set; }
|
||||
public Keywords keywords { get; set; }
|
||||
public Trailers trailers { get; set; }
|
||||
|
||||
public string GetOriginalTitle()
|
||||
{
|
||||
return original_name ?? original_title;
|
||||
}
|
||||
|
||||
public string GetTitle()
|
||||
{
|
||||
return name ?? title ?? GetOriginalTitle();
|
||||
}
|
||||
}
|
||||
|
||||
public int Order => 1;
|
||||
|
||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
|
@ -11,23 +11,21 @@ using MediaBrowser.Controller.Providers;
|
|||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Search;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
public class MovieDbSearch
|
||||
public class TmdbSearch
|
||||
{
|
||||
private static readonly CultureInfo EnUs = new CultureInfo("en-US");
|
||||
private const string Search3 = MovieDbProvider.BaseMovieDbUrl + @"3/search/{3}?api_key={1}&query={0}&language={2}";
|
||||
|
||||
internal static string ApiKey = "4219e299c89411838049ab0dab19ebd5";
|
||||
internal static string AcceptHeader = "application/json,image/*";
|
||||
private const string Search3 = TmdbUtils.BaseMovieDbUrl + @"3/search/{3}?api_key={1}&query={0}&language={2}";
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IJsonSerializer _json;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public MovieDbSearch(ILogger logger, IJsonSerializer json, ILibraryManager libraryManager)
|
||||
public TmdbSearch(ILogger logger, IJsonSerializer json, ILibraryManager libraryManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_json = json;
|
||||
|
@ -59,7 +57,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
return new List<RemoteSearchResult>();
|
||||
}
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -152,28 +150,28 @@ namespace MediaBrowser.Providers.Movies
|
|||
throw new ArgumentException("name");
|
||||
}
|
||||
|
||||
var url3 = string.Format(Search3, WebUtility.UrlEncode(name), ApiKey, language, type);
|
||||
var url3 = string.Format(Search3, WebUtility.UrlEncode(name), TmdbUtils.ApiKey, language, type);
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url3,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
var searchResults = await _json.DeserializeFromStreamAsync<TmdbMovieSearchResults>(json).ConfigureAwait(false);
|
||||
var searchResults = await _json.DeserializeFromStreamAsync<MovieSearchResults>(json).ConfigureAwait(false);
|
||||
|
||||
var results = searchResults.results ?? new List<TmdbMovieSearchResult>();
|
||||
var results = searchResults.results ?? new List<MovieResult>();
|
||||
|
||||
return results
|
||||
.Select(i =>
|
||||
{
|
||||
var remoteResult = new RemoteSearchResult
|
||||
{
|
||||
SearchProviderName = MovieDbProvider.Current.Name,
|
||||
SearchProviderName = TmdbMovieProvider.Current.Name,
|
||||
Name = i.title ?? i.name ?? i.original_title,
|
||||
ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path
|
||||
};
|
||||
|
@ -205,19 +203,19 @@ namespace MediaBrowser.Providers.Movies
|
|||
throw new ArgumentException("name");
|
||||
}
|
||||
|
||||
var url3 = string.Format(Search3, WebUtility.UrlEncode(name), ApiKey, language, "tv");
|
||||
var url3 = string.Format(Search3, WebUtility.UrlEncode(name), TmdbUtils.ApiKey, language, "tv");
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url3,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
var searchResults = await _json.DeserializeFromStreamAsync<TmdbTvSearchResults>(json).ConfigureAwait(false);
|
||||
var searchResults = await _json.DeserializeFromStreamAsync<TvSearchResults>(json).ConfigureAwait(false);
|
||||
|
||||
var results = searchResults.results ?? new List<TvResult>();
|
||||
|
||||
|
@ -226,7 +224,7 @@ namespace MediaBrowser.Providers.Movies
|
|||
{
|
||||
var remoteResult = new RemoteSearchResult
|
||||
{
|
||||
SearchProviderName = MovieDbProvider.Current.Name,
|
||||
SearchProviderName = TmdbMovieProvider.Current.Name,
|
||||
Name = i.name ?? i.original_name,
|
||||
ImageUrl = string.IsNullOrWhiteSpace(i.poster_path) ? null : baseImageUrl + i.poster_path
|
||||
};
|
||||
|
@ -250,145 +248,5 @@ namespace MediaBrowser.Providers.Movies
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class TmdbMovieSearchResult
|
||||
/// </summary>
|
||||
public class TmdbMovieSearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="TmdbMovieSearchResult" /> is adult.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
|
||||
public bool adult { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the backdrop_path.
|
||||
/// </summary>
|
||||
/// <value>The backdrop_path.</value>
|
||||
public string backdrop_path { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the original_title.
|
||||
/// </summary>
|
||||
/// <value>The original_title.</value>
|
||||
public string original_title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the original_name.
|
||||
/// </summary>
|
||||
/// <value>The original_name.</value>
|
||||
public string original_name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the release_date.
|
||||
/// </summary>
|
||||
/// <value>The release_date.</value>
|
||||
public string release_date { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the poster_path.
|
||||
/// </summary>
|
||||
/// <value>The poster_path.</value>
|
||||
public string poster_path { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the popularity.
|
||||
/// </summary>
|
||||
/// <value>The popularity.</value>
|
||||
public double popularity { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the vote_average.
|
||||
/// </summary>
|
||||
/// <value>The vote_average.</value>
|
||||
public double vote_average { get; set; }
|
||||
/// <summary>
|
||||
/// For collection search results
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the vote_count.
|
||||
/// </summary>
|
||||
/// <value>The vote_count.</value>
|
||||
public int vote_count { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class TmdbMovieSearchResults
|
||||
/// </summary>
|
||||
private class TmdbMovieSearchResults
|
||||
{
|
||||
/// <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<TmdbMovieSearchResult> 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; }
|
||||
}
|
||||
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class TmdbTvSearchResults
|
||||
/// </summary>
|
||||
private class TmdbTvSearchResults
|
||||
{
|
||||
/// <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<TvResult> 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; }
|
||||
}
|
||||
|
||||
public class ExternalIdLookupResult
|
||||
{
|
||||
public List<object> movie_results { get; set; }
|
||||
public List<object> person_results { get; set; }
|
||||
public List<TvResult> tv_results { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Movies
|
||||
{
|
||||
internal class TmdbImageSettings
|
||||
{
|
|
@ -7,14 +7,15 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.Music
|
||||
namespace MediaBrowser.Providers.Tmdb.Music
|
||||
{
|
||||
public class MovieDbMusicVideoProvider : IRemoteMetadataProvider<MusicVideo, MusicVideoInfo>
|
||||
public class TmdbMusicVideoProvider : IRemoteMetadataProvider<MusicVideo, MusicVideoInfo>
|
||||
{
|
||||
public Task<MetadataResult<MusicVideo>> GetMetadata(MusicVideoInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
return MovieDbProvider.Current.GetItemMetadata<MusicVideo>(info, cancellationToken);
|
||||
return TmdbMovieProvider.Current.GetItemMetadata<MusicVideo>(info, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MusicVideoInfo searchInfo, CancellationToken cancellationToken)
|
||||
|
@ -22,7 +23,7 @@ namespace MediaBrowser.Providers.Music
|
|||
return Task.FromResult((IEnumerable<RemoteSearchResult>)new List<RemoteSearchResult>());
|
||||
}
|
||||
|
||||
public string Name => MovieDbProvider.Current.Name;
|
||||
public string Name => TmdbMovieProvider.Current.Name;
|
||||
|
||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||
{
|
20
MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs
Normal file
20
MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.People
|
||||
{
|
||||
public class TmdbPersonExternalId : IExternalId
|
||||
{
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => TmdbUtils.BaseMovieDbUrl + "person/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Person;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,16 +11,19 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Models.People;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.People
|
||||
namespace MediaBrowser.Providers.Tmdb.People
|
||||
{
|
||||
public class MovieDbPersonImageProvider : IRemoteImageProvider, IHasOrder
|
||||
public class TmdbPersonImageProvider : IRemoteImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
public MovieDbPersonImageProvider(IServerConfigurationManager config, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
||||
public TmdbPersonImageProvider(IServerConfigurationManager config, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
||||
{
|
||||
_config = config;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
|
@ -29,7 +32,7 @@ namespace MediaBrowser.Providers.People
|
|||
|
||||
public string Name => ProviderName;
|
||||
|
||||
public static string ProviderName => "TheMovieDb";
|
||||
public static string ProviderName => TmdbUtils.ProviderName;
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
|
@ -51,15 +54,15 @@ namespace MediaBrowser.Providers.People
|
|||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
await MovieDbPersonProvider.Current.EnsurePersonInfo(id, cancellationToken).ConfigureAwait(false);
|
||||
await TmdbPersonProvider.Current.EnsurePersonInfo(id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var dataFilePath = MovieDbPersonProvider.GetPersonDataFilePath(_config.ApplicationPaths, id);
|
||||
var dataFilePath = TmdbPersonProvider.GetPersonDataFilePath(_config.ApplicationPaths, id);
|
||||
|
||||
var result = _jsonSerializer.DeserializeFromFile<MovieDbPersonProvider.PersonResult>(dataFilePath);
|
||||
var result = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath);
|
||||
|
||||
var images = result.images ?? new MovieDbPersonProvider.Images();
|
||||
var images = result.images ?? new PersonImages();
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -69,7 +72,7 @@ namespace MediaBrowser.Providers.People
|
|||
return new List<RemoteImageInfo>();
|
||||
}
|
||||
|
||||
private IEnumerable<RemoteImageInfo> GetImages(MovieDbPersonProvider.Images images, string preferredLanguage, string baseImageUrl)
|
||||
private IEnumerable<RemoteImageInfo> GetImages(PersonImages images, string preferredLanguage, string baseImageUrl)
|
||||
{
|
||||
var list = new List<RemoteImageInfo>();
|
||||
|
||||
|
@ -113,9 +116,9 @@ namespace MediaBrowser.Providers.People
|
|||
.ThenByDescending(i => i.VoteCount ?? 0);
|
||||
}
|
||||
|
||||
private string GetLanguage(MovieDbPersonProvider.Profile profile)
|
||||
private string GetLanguage(Profile profile)
|
||||
{
|
||||
return profile.iso_639_1 == null ? null : profile.iso_639_1.ToString();
|
||||
return profile.iso_639_1?.ToString();
|
||||
}
|
||||
|
||||
public int Order => 0;
|
|
@ -17,16 +17,18 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Models.People;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.People
|
||||
namespace MediaBrowser.Providers.Tmdb.People
|
||||
{
|
||||
public class MovieDbPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo>
|
||||
public class TmdbPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo>
|
||||
{
|
||||
const string DataFileName = "info.json";
|
||||
|
||||
internal static MovieDbPersonProvider Current { get; private set; }
|
||||
internal static TmdbPersonProvider Current { get; private set; }
|
||||
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
@ -34,7 +36,7 @@ namespace MediaBrowser.Providers.People
|
|||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public MovieDbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
|
||||
public TmdbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_configurationManager = configurationManager;
|
||||
|
@ -44,13 +46,13 @@ namespace MediaBrowser.Providers.People
|
|||
Current = this;
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(PersonLookupInfo searchInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
var tmdbId = searchInfo.GetProviderId(MetadataProviders.Tmdb);
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -61,7 +63,7 @@ namespace MediaBrowser.Providers.People
|
|||
var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId);
|
||||
var info = _jsonSerializer.DeserializeFromFile<PersonResult>(dataFilePath);
|
||||
|
||||
var images = (info.images ?? new Images()).profiles ?? new List<Profile>();
|
||||
var images = (info.images ?? new PersonImages()).profiles ?? new List<Profile>();
|
||||
|
||||
var result = new RemoteSearchResult
|
||||
{
|
||||
|
@ -84,13 +86,13 @@ namespace MediaBrowser.Providers.People
|
|||
return new List<RemoteSearchResult>();
|
||||
}
|
||||
|
||||
var url = string.Format(MovieDbProvider.BaseMovieDbUrl + @"3/search/person?api_key={1}&query={0}", WebUtility.UrlEncode(searchInfo.Name), MovieDbProvider.ApiKey);
|
||||
var url = string.Format(TmdbUtils.BaseMovieDbUrl + @"3/search/person?api_key={1}&query={0}", WebUtility.UrlEncode(searchInfo.Name), TmdbUtils.ApiKey);
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
|
@ -112,7 +114,7 @@ namespace MediaBrowser.Providers.People
|
|||
|
||||
Name = i.Name,
|
||||
|
||||
ImageUrl = string.IsNullOrEmpty(i.Profile_Path) ? null : (baseImageUrl + i.Profile_Path)
|
||||
ImageUrl = string.IsNullOrEmpty(i.Profile_Path) ? null : baseImageUrl + i.Profile_Path
|
||||
};
|
||||
|
||||
result.SetProviderId(MetadataProviders.Tmdb, i.Id.ToString(_usCulture));
|
||||
|
@ -217,13 +219,13 @@ namespace MediaBrowser.Providers.People
|
|||
return;
|
||||
}
|
||||
|
||||
var url = string.Format(MovieDbProvider.BaseMovieDbUrl + @"3/person/{1}?api_key={0}&append_to_response=credits,images,external_ids", MovieDbProvider.ApiKey, id);
|
||||
var url = string.Format(TmdbUtils.BaseMovieDbUrl + @"3/person/{1}?api_key={0}&append_to_response=credits,images,external_ids", TmdbUtils.ApiKey, id);
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
|
@ -256,133 +258,6 @@ namespace MediaBrowser.Providers.People
|
|||
return Path.Combine(appPaths.CachePath, "tmdb-people");
|
||||
}
|
||||
|
||||
#region Result Objects
|
||||
/// <summary>
|
||||
/// Class PersonSearchResult
|
||||
/// </summary>
|
||||
public class PersonSearchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="PersonSearchResult" /> is adult.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if adult; otherwise, <c>false</c>.</value>
|
||||
public bool Adult { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the profile_ path.
|
||||
/// </summary>
|
||||
/// <value>The profile_ path.</value>
|
||||
public string Profile_Path { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class PersonSearchResults
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
public class Cast
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string title { get; set; }
|
||||
public string character { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public bool adult { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string title { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string department { get; set; }
|
||||
public string job { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public bool adult { get; set; }
|
||||
}
|
||||
|
||||
public class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
|
||||
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 class Images
|
||||
{
|
||||
public List<Profile> profiles { get; set; }
|
||||
}
|
||||
|
||||
public class ExternalIds
|
||||
{
|
||||
public string imdb_id { get; set; }
|
||||
public string freebase_mid { get; set; }
|
||||
public string freebase_id { get; set; }
|
||||
public int tvrage_id { get; set; }
|
||||
}
|
||||
|
||||
public class PersonResult
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public List<object> also_known_as { get; set; }
|
||||
public string biography { get; set; }
|
||||
public string birthday { get; set; }
|
||||
public string deathday { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public string imdb_id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string place_of_birth { get; set; }
|
||||
public double popularity { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public Credits credits { get; set; }
|
||||
public Images images { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||
{
|
||||
return _httpClient.GetResponse(new HttpRequestOptions
|
|
@ -14,16 +14,18 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class MovieDbEpisodeImageProvider :
|
||||
MovieDbProviderBase,
|
||||
public class TmdbEpisodeImageProvider :
|
||||
TmdbEpisodeProviderBase,
|
||||
IRemoteImageProvider,
|
||||
IHasOrder
|
||||
{
|
||||
public MovieDbEpisodeImageProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
public TmdbEpisodeImageProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
: base(httpClient, configurationManager, jsonSerializer, fileSystem, localization, loggerFactory)
|
||||
{ }
|
||||
|
||||
|
@ -62,7 +64,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
var response = await GetEpisodeInfo(seriesId, seasonNumber.Value, episodeNumber.Value,
|
||||
language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -73,7 +75,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
|
@ -106,7 +108,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
}
|
||||
|
||||
private IEnumerable<Still> GetPosters(Images images)
|
||||
private IEnumerable<Still> GetPosters(StillImages images)
|
||||
{
|
||||
return images.stills ?? new List<Still>();
|
||||
}
|
||||
|
@ -117,12 +119,13 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
return GetResponse(url, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
return item is Controller.Entities.TV.Episode;
|
||||
}
|
||||
|
||||
// After TheTvDb
|
||||
public int Order => 1;
|
||||
}
|
|
@ -18,14 +18,14 @@ using MediaBrowser.Model.Providers;
|
|||
using MediaBrowser.Model.Serialization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class MovieDbEpisodeProvider :
|
||||
MovieDbProviderBase,
|
||||
public class TmdbEpisodeProvider :
|
||||
TmdbEpisodeProviderBase,
|
||||
IRemoteMetadataProvider<Episode, EpisodeInfo>,
|
||||
IHasOrder
|
||||
{
|
||||
public MovieDbEpisodeProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
public TmdbEpisodeProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
: base(httpClient, configurationManager, jsonSerializer, fileSystem, localization, loggerFactory)
|
||||
{ }
|
||||
|
||||
|
@ -211,6 +211,6 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
// After TheTvDb
|
||||
public int Order => 1;
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
@ -10,13 +9,15 @@ using MediaBrowser.Model.Globalization;
|
|||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.TV;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public abstract class MovieDbProviderBase
|
||||
public abstract class TmdbEpisodeProviderBase
|
||||
{
|
||||
private const string EpisodeUrlPattern = MovieDbProvider.BaseMovieDbUrl + @"3/tv/{0}/season/{1}/episode/{2}?api_key={3}&append_to_response=images,external_ids,credits,videos";
|
||||
private const string EpisodeUrlPattern = TmdbUtils.BaseMovieDbUrl + @"3/tv/{0}/season/{1}/episode/{2}?api_key={3}&append_to_response=images,external_ids,credits,videos";
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IServerConfigurationManager _configurationManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
@ -24,7 +25,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
private readonly ILocalizationManager _localization;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public MovieDbProviderBase(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
protected TmdbEpisodeProviderBase(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_configurationManager = configurationManager;
|
||||
|
@ -36,7 +37,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
protected ILogger Logger => _logger;
|
||||
|
||||
protected async Task<RootObject> GetEpisodeInfo(string seriesTmdbId, int season, int episodeNumber, string preferredMetadataLanguage,
|
||||
protected async Task<EpisodeResult> GetEpisodeInfo(string seriesTmdbId, int season, int episodeNumber, string preferredMetadataLanguage,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
await EnsureEpisodeInfo(seriesTmdbId, season, episodeNumber, preferredMetadataLanguage, cancellationToken)
|
||||
|
@ -44,7 +45,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
var dataFilePath = GetDataFilePath(seriesTmdbId, season, episodeNumber, preferredMetadataLanguage);
|
||||
|
||||
return _jsonSerializer.DeserializeFromFile<RootObject>(dataFilePath);
|
||||
return _jsonSerializer.DeserializeFromFile<EpisodeResult>(dataFilePath);
|
||||
}
|
||||
|
||||
internal Task EnsureEpisodeInfo(string tmdbId, int seasonNumber, int episodeNumber, string language, CancellationToken cancellationToken)
|
||||
|
@ -85,7 +86,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
throw new ArgumentNullException(nameof(preferredLanguage));
|
||||
}
|
||||
|
||||
var path = MovieDbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
|
||||
var path = TmdbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
|
||||
|
||||
var filename = string.Format("season-{0}-episode-{1}-{2}.json",
|
||||
seasonNumber.ToString(CultureInfo.InvariantCulture),
|
||||
|
@ -105,32 +106,32 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
|
||||
}
|
||||
|
||||
internal async Task<RootObject> FetchMainResult(string urlPattern, string id, int seasonNumber, int episodeNumber, string language, CancellationToken cancellationToken)
|
||||
internal async Task<EpisodeResult> FetchMainResult(string urlPattern, string id, int seasonNumber, int episodeNumber, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(urlPattern, id, seasonNumber.ToString(CultureInfo.InvariantCulture), episodeNumber, MovieDbProvider.ApiKey);
|
||||
var url = string.Format(urlPattern, id, seasonNumber.ToString(CultureInfo.InvariantCulture), episodeNumber, TmdbUtils.ApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
url += string.Format("&language={0}", language);
|
||||
}
|
||||
|
||||
var includeImageLanguageParam = MovieDbProvider.GetImageLanguagesParam(language);
|
||||
var includeImageLanguageParam = TmdbMovieProvider.GetImageLanguagesParam(language);
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + includeImageLanguageParam;
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<EpisodeResult>(json).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,103 +144,5 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
Url = url
|
||||
});
|
||||
}
|
||||
|
||||
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 class Images
|
||||
{
|
||||
public List<Still> stills { get; set; }
|
||||
}
|
||||
|
||||
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 class Cast
|
||||
{
|
||||
public string character { get; set; }
|
||||
public string credit_id { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public int order { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public 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 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 class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
public List<GuestStar> guest_stars { get; set; }
|
||||
}
|
||||
|
||||
public class Videos
|
||||
{
|
||||
public List<Video> results { get; set; }
|
||||
}
|
||||
|
||||
public class Video
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string key { get; set; }
|
||||
public string name { get; set; }
|
||||
public string site { get; set; }
|
||||
public string size { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
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 Images images { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
public Credits credits { get; set; }
|
||||
public Videos videos { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
@ -16,13 +15,16 @@ using MediaBrowser.Model.Net;
|
|||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.TV;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Season = MediaBrowser.Controller.Entities.TV.Season;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class MovieDbSeasonProvider : IRemoteMetadataProvider<Season, SeasonInfo>
|
||||
public class TmdbSeasonProvider : IRemoteMetadataProvider<Season, SeasonInfo>
|
||||
{
|
||||
private const string GetTvInfo3 = MovieDbProvider.BaseMovieDbUrl + @"3/tv/{0}/season/{1}?api_key={2}&append_to_response=images,keywords,external_ids,credits,videos";
|
||||
private const string GetTvInfo3 = TmdbUtils.BaseMovieDbUrl + @"3/tv/{0}/season/{1}?api_key={2}&append_to_response=images,keywords,external_ids,credits,videos";
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IServerConfigurationManager _configurationManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
@ -30,7 +32,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
private readonly ILocalizationManager _localization;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public MovieDbSeasonProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILocalizationManager localization, IJsonSerializer jsonSerializer, ILoggerFactory loggerFactory)
|
||||
public TmdbSeasonProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ILocalizationManager localization, IJsonSerializer jsonSerializer, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_configurationManager = configurationManager;
|
||||
|
@ -108,7 +110,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
return result;
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeasonInfo searchInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -124,7 +126,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
});
|
||||
}
|
||||
|
||||
private async Task<RootObject> GetSeasonInfo(string seriesTmdbId, int season, string preferredMetadataLanguage,
|
||||
private async Task<SeasonResult> GetSeasonInfo(string seriesTmdbId, int season, string preferredMetadataLanguage,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
await EnsureSeasonInfo(seriesTmdbId, season, preferredMetadataLanguage, cancellationToken)
|
||||
|
@ -132,7 +134,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
var dataFilePath = GetDataFilePath(seriesTmdbId, season, preferredMetadataLanguage);
|
||||
|
||||
return _jsonSerializer.DeserializeFromFile<RootObject>(dataFilePath);
|
||||
return _jsonSerializer.DeserializeFromFile<SeasonResult>(dataFilePath);
|
||||
}
|
||||
|
||||
internal Task EnsureSeasonInfo(string tmdbId, int seasonNumber, string language, CancellationToken cancellationToken)
|
||||
|
@ -173,7 +175,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
throw new ArgumentNullException(nameof(preferredLanguage));
|
||||
}
|
||||
|
||||
var path = MovieDbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
|
||||
var path = TmdbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
|
||||
|
||||
var filename = string.Format("season-{0}-{1}.json",
|
||||
seasonNumber.ToString(CultureInfo.InvariantCulture),
|
||||
|
@ -192,117 +194,34 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
|
||||
}
|
||||
|
||||
internal async Task<RootObject> FetchMainResult(string id, int seasonNumber, string language, CancellationToken cancellationToken)
|
||||
internal async Task<SeasonResult> FetchMainResult(string id, int seasonNumber, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(GetTvInfo3, id, seasonNumber.ToString(CultureInfo.InvariantCulture), MovieDbProvider.ApiKey);
|
||||
var url = string.Format(GetTvInfo3, id, seasonNumber.ToString(CultureInfo.InvariantCulture), TmdbUtils.ApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
url += string.Format("&language={0}", MovieDbProvider.NormalizeLanguage(language));
|
||||
url += string.Format("&language={0}", TmdbMovieProvider.NormalizeLanguage(language));
|
||||
}
|
||||
|
||||
var includeImageLanguageParam = MovieDbProvider.GetImageLanguagesParam(language);
|
||||
var includeImageLanguageParam = TmdbMovieProvider.GetImageLanguagesParam(language);
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + includeImageLanguageParam;
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
return await _jsonSerializer.DeserializeFromStreamAsync<SeasonResult>(json).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 class Cast
|
||||
{
|
||||
public string character { get; set; }
|
||||
public string credit_id { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public int order { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public string credit_id { get; set; }
|
||||
public string department { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string job { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
public class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
|
||||
public class Poster
|
||||
{
|
||||
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 class Images
|
||||
{
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
|
||||
public class ExternalIds
|
||||
{
|
||||
public string freebase_id { get; set; }
|
||||
public string freebase_mid { get; set; }
|
||||
public int tvdb_id { get; set; }
|
||||
public object tvrage_id { get; set; }
|
||||
}
|
||||
|
||||
public class Videos
|
||||
{
|
||||
public List<object> results { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public DateTime air_date { get; set; }
|
||||
public List<Episode> 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 Images images { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
public Videos videos { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
20
MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs
Normal file
20
MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class TmdbSeriesExternalId : IExternalId
|
||||
{
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public string Key => MetadataProviders.Tmdb.ToString();
|
||||
|
||||
public string UrlFormatString => TmdbUtils.BaseMovieDbUrl + "tv/{0}";
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Series;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,16 +13,19 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
using MediaBrowser.Providers.Tmdb.Models.TV;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class MovieDbSeriesImageProvider : IRemoteImageProvider, IHasOrder
|
||||
public class TmdbSeriesImageProvider : IRemoteImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public MovieDbSeriesImageProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem)
|
||||
public TmdbSeriesImageProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, IFileSystem fileSystem)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClient = httpClient;
|
||||
|
@ -31,7 +34,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
public string Name => ProviderName;
|
||||
|
||||
public static string ProviderName => "TheMovieDb";
|
||||
public static string ProviderName => TmdbUtils.ProviderName;
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
|
@ -58,7 +61,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
return list;
|
||||
}
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
|
@ -71,7 +74,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
VoteCount = i.vote_count,
|
||||
Width = i.width,
|
||||
Height = i.height,
|
||||
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
Language = TmdbMovieProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Primary,
|
||||
RatingType = RatingType.Score
|
||||
|
@ -118,19 +121,18 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
/// Gets the posters.
|
||||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
private IEnumerable<MovieDbSeriesProvider.Poster> GetPosters(MovieDbSeriesProvider.Images images)
|
||||
private IEnumerable<Poster> GetPosters(Images images)
|
||||
{
|
||||
return images.posters ?? new List<MovieDbSeriesProvider.Poster>();
|
||||
return images.posters ?? new List<Poster>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the backdrops.
|
||||
/// </summary>
|
||||
/// <param name="images">The images.</param>
|
||||
private IEnumerable<MovieDbSeriesProvider.Backdrop> GetBackdrops(MovieDbSeriesProvider.Images images)
|
||||
private IEnumerable<Backdrop> GetBackdrops(Images images)
|
||||
{
|
||||
var eligibleBackdrops = images.backdrops == null ? new List<MovieDbSeriesProvider.Backdrop>() :
|
||||
images.backdrops;
|
||||
var eligibleBackdrops = images.backdrops ?? new List<Backdrop>();
|
||||
|
||||
return eligibleBackdrops.OrderByDescending(i => i.vote_average)
|
||||
.ThenByDescending(i => i.vote_count);
|
||||
|
@ -144,7 +146,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{MovieImages}.</returns>
|
||||
private async Task<MovieDbSeriesProvider.Images> FetchImages(BaseItem item, string language, IJsonSerializer jsonSerializer,
|
||||
private async Task<Images> FetchImages(BaseItem item, string language, IJsonSerializer jsonSerializer,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var tmdbId = item.GetProviderId(MetadataProviders.Tmdb);
|
||||
|
@ -154,9 +156,9 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
return null;
|
||||
}
|
||||
|
||||
await MovieDbSeriesProvider.Current.EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
await TmdbSeriesProvider.Current.EnsureSeriesInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var path = MovieDbSeriesProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
var path = TmdbSeriesProvider.Current.GetDataFilePath(tmdbId, language);
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
|
@ -164,7 +166,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
return jsonSerializer.DeserializeFromFile<MovieDbSeriesProvider.RootObject>(path).images;
|
||||
return jsonSerializer.DeserializeFromFile<SeriesResult>(path).images;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,16 +18,19 @@ using MediaBrowser.Model.IO;
|
|||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Models.Search;
|
||||
using MediaBrowser.Providers.Tmdb.Models.TV;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Providers.TV.TheMovieDb
|
||||
namespace MediaBrowser.Providers.Tmdb.TV
|
||||
{
|
||||
public class MovieDbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
||||
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
||||
{
|
||||
private const string GetTvInfo3 = MovieDbProvider.BaseMovieDbUrl + @"3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos,content_ratings";
|
||||
private const string GetTvInfo3 = TmdbUtils.BaseMovieDbUrl + @"3/tv/{0}?api_key={1}&append_to_response=credits,images,keywords,external_ids,videos,content_ratings";
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
|
||||
internal static MovieDbSeriesProvider Current { get; private set; }
|
||||
internal static TmdbSeriesProvider Current { get; private set; }
|
||||
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
@ -37,7 +40,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
private readonly IHttpClient _httpClient;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public MovieDbSeriesProvider(IJsonSerializer jsonSerializer, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
||||
public TmdbSeriesProvider(IJsonSerializer jsonSerializer, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILogger logger, ILocalizationManager localization, IHttpClient httpClient, ILibraryManager libraryManager)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_fileSystem = fileSystem;
|
||||
|
@ -49,7 +52,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
Current = this;
|
||||
}
|
||||
|
||||
public string Name => "TheMovieDb";
|
||||
public string Name => TmdbUtils.ProviderName;
|
||||
|
||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@ -63,9 +66,9 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
var dataFilePath = GetDataFilePath(tmdbId, searchInfo.MetadataLanguage);
|
||||
|
||||
var obj = _jsonSerializer.DeserializeFromFile<RootObject>(dataFilePath);
|
||||
var obj = _jsonSerializer.DeserializeFromFile<SeriesResult>(dataFilePath);
|
||||
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
var remoteResult = new RemoteSearchResult
|
||||
|
@ -110,7 +113,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
}
|
||||
}
|
||||
|
||||
return await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
return await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
||||
|
@ -153,7 +156,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
result.QueriedById = false;
|
||||
var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
|
||||
var searchResults = await new TmdbSearch(_logger, _jsonSerializer, _libraryManager).GetSearchResults(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var searchResult = searchResults.FirstOrDefault();
|
||||
|
||||
|
@ -177,7 +180,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
private async Task<MetadataResult<Series>> FetchMovieData(string tmdbId, string language, string preferredCountryCode, CancellationToken cancellationToken)
|
||||
{
|
||||
RootObject seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
SeriesResult seriesInfo = await FetchMainResult(tmdbId, language, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (seriesInfo == null)
|
||||
{
|
||||
|
@ -196,14 +199,14 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
result.Item = new Series();
|
||||
result.ResultLanguage = seriesInfo.ResultLanguage;
|
||||
|
||||
var settings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var settings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
ProcessMainInfo(result, seriesInfo, preferredCountryCode, settings);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void ProcessMainInfo(MetadataResult<Series> seriesResult, RootObject seriesInfo, string preferredCountryCode, TmdbSettingsResult settings)
|
||||
private void ProcessMainInfo(MetadataResult<Series> seriesResult, SeriesResult seriesInfo, string preferredCountryCode, TmdbSettingsResult settings)
|
||||
{
|
||||
var series = seriesResult.Item;
|
||||
|
||||
|
@ -342,7 +345,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
internal async Task DownloadSeriesInfo(string id, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
||||
{
|
||||
RootObject mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||
SeriesResult mainResult = await FetchMainResult(id, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (mainResult == null)
|
||||
{
|
||||
|
@ -356,31 +359,31 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
|
||||
}
|
||||
|
||||
internal async Task<RootObject> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
||||
internal async Task<SeriesResult> FetchMainResult(string id, string language, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey);
|
||||
var url = string.Format(GetTvInfo3, id, TmdbUtils.ApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
url += "&language=" + MovieDbProvider.NormalizeLanguage(language)
|
||||
+ "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
||||
url += "&language=" + TmdbMovieProvider.NormalizeLanguage(language)
|
||||
+ "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language); // Get images in english and with no language
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
RootObject mainResult;
|
||||
SeriesResult mainResult;
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
mainResult = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
mainResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false);
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
|
@ -399,25 +402,25 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
{
|
||||
_logger.LogInformation("MovieDbSeriesProvider couldn't find meta for language {Language}. Trying English...", language);
|
||||
|
||||
url = string.Format(GetTvInfo3, id, MovieDbProvider.ApiKey) + "&language=en";
|
||||
url = string.Format(GetTvInfo3, id, TmdbUtils.ApiKey) + "&language=en";
|
||||
|
||||
if (!string.IsNullOrEmpty(language))
|
||||
{
|
||||
// Get images in english and with no language
|
||||
url += "&include_image_language=" + MovieDbProvider.GetImageLanguagesParam(language);
|
||||
url += "&include_image_language=" + TmdbMovieProvider.GetImageLanguagesParam(language);
|
||||
}
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<RootObject>(json).ConfigureAwait(false);
|
||||
var englishResult = await _jsonSerializer.DeserializeFromStreamAsync<SeriesResult>(json).ConfigureAwait(false);
|
||||
|
||||
mainResult.overview = englishResult.overview;
|
||||
mainResult.ResultLanguage = "en";
|
||||
|
@ -467,22 +470,22 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
private async Task<RemoteSearchResult> FindByExternalId(string id, string externalSource, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(MovieDbProvider.BaseMovieDbUrl + @"3/find/{0}?api_key={1}&external_source={2}",
|
||||
var url = string.Format(TmdbUtils.BaseMovieDbUrl + @"3/find/{0}?api_key={1}&external_source={2}",
|
||||
id,
|
||||
MovieDbProvider.ApiKey,
|
||||
TmdbUtils.ApiKey,
|
||||
externalSource);
|
||||
|
||||
using (var response = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
using (var response = await TmdbMovieProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = url,
|
||||
CancellationToken = cancellationToken,
|
||||
AcceptHeader = MovieDbProvider.AcceptHeader
|
||||
AcceptHeader = TmdbUtils.AcceptHeader
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
using (var json = response.Content)
|
||||
{
|
||||
var result = await _jsonSerializer.DeserializeFromStreamAsync<MovieDbSearch.ExternalIdLookupResult>(json).ConfigureAwait(false);
|
||||
var result = await _jsonSerializer.DeserializeFromStreamAsync<ExternalIdLookupResult>(json).ConfigureAwait(false);
|
||||
|
||||
if (result != null && result.tv_results != null)
|
||||
{
|
||||
|
@ -490,7 +493,7 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
|
||||
if (tv != null)
|
||||
{
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbSettings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
var tmdbImageUrl = tmdbSettings.images.GetImageUrl("original");
|
||||
|
||||
var remoteResult = new RemoteSearchResult
|
||||
|
@ -511,163 +514,6 @@ namespace MediaBrowser.Providers.TV.TheMovieDb
|
|||
return null;
|
||||
}
|
||||
|
||||
public class CreatedBy
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
public class Genre
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Network
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
|
||||
public class Season
|
||||
{
|
||||
public string air_date { get; set; }
|
||||
public int episode_count { get; set; }
|
||||
public int id { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public int season_number { get; set; }
|
||||
}
|
||||
|
||||
public class Cast
|
||||
{
|
||||
public string character { get; set; }
|
||||
public string credit_id { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
public int order { get; set; }
|
||||
}
|
||||
|
||||
public class Crew
|
||||
{
|
||||
public string credit_id { get; set; }
|
||||
public string department { get; set; }
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string job { get; set; }
|
||||
public string profile_path { get; set; }
|
||||
}
|
||||
|
||||
public class Credits
|
||||
{
|
||||
public List<Cast> cast { get; set; }
|
||||
public List<Crew> crew { get; set; }
|
||||
}
|
||||
|
||||
public class Backdrop
|
||||
{
|
||||
public double aspect_ratio { get; set; }
|
||||
public string file_path { get; set; }
|
||||
public int height { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public int width { get; set; }
|
||||
}
|
||||
|
||||
public class Poster
|
||||
{
|
||||
public double aspect_ratio { get; set; }
|
||||
public string file_path { get; set; }
|
||||
public int height { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public int width { get; set; }
|
||||
}
|
||||
|
||||
public class Images
|
||||
{
|
||||
public List<Backdrop> backdrops { get; set; }
|
||||
public List<Poster> posters { get; set; }
|
||||
}
|
||||
|
||||
public class Keywords
|
||||
{
|
||||
public List<object> results { get; set; }
|
||||
}
|
||||
|
||||
public class ExternalIds
|
||||
{
|
||||
public string imdb_id { get; set; }
|
||||
public string freebase_id { get; set; }
|
||||
public string freebase_mid { get; set; }
|
||||
public int tvdb_id { get; set; }
|
||||
public int tvrage_id { get; set; }
|
||||
}
|
||||
|
||||
public class Videos
|
||||
{
|
||||
public List<Video> results { get; set; }
|
||||
}
|
||||
|
||||
public class Video
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string key { get; set; }
|
||||
public string name { get; set; }
|
||||
public string site { get; set; }
|
||||
public string size { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
|
||||
public class ContentRating
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public string rating { get; set; }
|
||||
}
|
||||
|
||||
public class ContentRatings
|
||||
{
|
||||
public List<ContentRating> results { get; set; }
|
||||
}
|
||||
|
||||
public class RootObject
|
||||
{
|
||||
public string backdrop_path { get; set; }
|
||||
public List<CreatedBy> created_by { get; set; }
|
||||
public List<int> episode_run_time { get; set; }
|
||||
public DateTime first_air_date { get; set; }
|
||||
public List<Genre> genres { get; set; }
|
||||
public string homepage { get; set; }
|
||||
public int id { get; set; }
|
||||
public bool in_production { get; set; }
|
||||
public List<string> languages { get; set; }
|
||||
public DateTime last_air_date { get; set; }
|
||||
public string name { get; set; }
|
||||
public List<Network> networks { get; set; }
|
||||
public int number_of_episodes { get; set; }
|
||||
public int number_of_seasons { get; set; }
|
||||
public string original_name { get; set; }
|
||||
public List<string> origin_country { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string popularity { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public List<Season> seasons { get; set; }
|
||||
public string status { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public Credits credits { get; set; }
|
||||
public Images images { get; set; }
|
||||
public Keywords keywords { get; set; }
|
||||
public ExternalIds external_ids { get; set; }
|
||||
public Videos videos { get; set; }
|
||||
public ContentRatings content_ratings { get; set; }
|
||||
public string ResultLanguage { get; set; }
|
||||
}
|
||||
// After TheTVDB
|
||||
public int Order => 1;
|
||||
|
30
MediaBrowser.Providers/Tmdb/TmdbUtils.cs
Normal file
30
MediaBrowser.Providers/Tmdb/TmdbUtils.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Providers.Tmdb.Models.General;
|
||||
|
||||
namespace MediaBrowser.Providers.Tmdb
|
||||
{
|
||||
public static class TmdbUtils
|
||||
{
|
||||
public const string BaseMovieDbUrl = "https://www.themoviedb.org/";
|
||||
public const string ProviderName = "TheMovieDb";
|
||||
public const string ApiKey = "4219e299c89411838049ab0dab19ebd5";
|
||||
public const string AcceptHeader = "application/json,image/*";
|
||||
|
||||
public static string MapCrewToPersonType(Crew crew)
|
||||
{
|
||||
if (crew.department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
|
||||
&& crew.job.IndexOf("producer", StringComparison.InvariantCultureIgnoreCase) != -1)
|
||||
{
|
||||
return PersonType.Producer;
|
||||
}
|
||||
|
||||
if (crew.department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return PersonType.Writer;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,29 +5,31 @@ using MediaBrowser.Common.Net;
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Providers.Movies;
|
||||
using MediaBrowser.Providers.Tmdb.Movies;
|
||||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
namespace MediaBrowser.Providers.Tmdb.Trailers
|
||||
{
|
||||
public class MovieDbTrailerProvider : IHasOrder, IRemoteMetadataProvider<Trailer, TrailerInfo>
|
||||
public class TmdbTrailerProvider : IHasOrder, IRemoteMetadataProvider<Trailer, TrailerInfo>
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
public MovieDbTrailerProvider(IHttpClient httpClient)
|
||||
public TmdbTrailerProvider(IHttpClient httpClient)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TrailerInfo searchInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
return MovieDbProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
|
||||
return TmdbMovieProvider.Current.GetMovieSearchResults(searchInfo, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<MetadataResult<Trailer>> GetMetadata(TrailerInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
return MovieDbProvider.Current.GetItemMetadata<Trailer>(info, cancellationToken);
|
||||
return TmdbMovieProvider.Current.GetItemMetadata<Trailer>(info, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => MovieDbProvider.Current.Name;
|
||||
public string Name => TmdbMovieProvider.Current.Name;
|
||||
|
||||
public int Order => 0;
|
||||
|
Loading…
Reference in New Issue
Block a user