Add xmldocs for TMDb provider, correct provider spelling
This commit is contained in:
parent
f4ab56e12a
commit
072651c4be
|
@ -2590,9 +2590,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Anime series don't generally have a season in their file name, however,
|
Anime series don't generally have a season in their file name, however,
|
||||||
tvdb needs a season to correctly get the metadata.
|
TVDb needs a season to correctly get the metadata.
|
||||||
Hence, a null season needs to be filled with something. */
|
Hence, a null season needs to be filled with something. */
|
||||||
// FIXME perhaps this would be better for tvdb parser to ask for season 1 if no season is specified
|
// FIXME perhaps this would be better for TVDb parser to ask for season 1 if no season is specified
|
||||||
episode.ParentIndexNumber = 1;
|
episode.ParentIndexNumber = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
|
|
||||||
if (!justName.IsEmpty)
|
if (!justName.IsEmpty)
|
||||||
{
|
{
|
||||||
// check for tmdb id
|
// Check for TMDb id
|
||||||
var tmdbid = justName.GetAttributeValue("tmdbid");
|
var tmdbid = justName.GetAttributeValue("tmdbid");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(tmdbid))
|
if (!string.IsNullOrWhiteSpace(tmdbid))
|
||||||
|
@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(item.Path))
|
if (!string.IsNullOrEmpty(item.Path))
|
||||||
{
|
{
|
||||||
// check for imdb id - we use full media path, as we can assume, that this will match in any use case (either id in parent dir or in file name)
|
// Check for IMDb id - we use full media path, as we can assume that this will match in any use case (wither id in parent dir or in file name)
|
||||||
var imdbid = item.Path.AsSpan().GetAttributeValue("imdbid");
|
var imdbid = item.Path.AsSpan().GetAttributeValue("imdbid");
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(imdbid))
|
if (!string.IsNullOrWhiteSpace(imdbid))
|
||||||
|
|
|
@ -87,9 +87,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
||||||
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
||||||
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
||||||
/// <param name="hasImdbId">Optional filter by items that have an imdb id or not.</param>
|
/// <param name="hasImdbId">Optional filter by items that have an IMDb id or not.</param>
|
||||||
/// <param name="hasTmdbId">Optional filter by items that have a tmdb id or not.</param>
|
/// <param name="hasTmdbId">Optional filter by items that have a TMDb id or not.</param>
|
||||||
/// <param name="hasTvdbId">Optional filter by items that have a tvdb id or not.</param>
|
/// <param name="hasTvdbId">Optional filter by items that have a TVDb id or not.</param>
|
||||||
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
||||||
/// <param name="isSeries">Optional filter for live tv series.</param>
|
/// <param name="isSeries">Optional filter for live tv series.</param>
|
||||||
/// <param name="isNews">Optional filter for live tv news.</param>
|
/// <param name="isNews">Optional filter for live tv news.</param>
|
||||||
|
@ -100,7 +100,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||||
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
||||||
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
||||||
/// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
|
/// <param name="sortOrder">Sort Order - Ascending, Descending.</param>
|
||||||
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
||||||
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
||||||
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
||||||
|
@ -536,9 +536,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
||||||
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
||||||
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
||||||
/// <param name="hasImdbId">Optional filter by items that have an imdb id or not.</param>
|
/// <param name="hasImdbId">Optional filter by items that have an IMDb id or not.</param>
|
||||||
/// <param name="hasTmdbId">Optional filter by items that have a tmdb id or not.</param>
|
/// <param name="hasTmdbId">Optional filter by items that have a TMDb id or not.</param>
|
||||||
/// <param name="hasTvdbId">Optional filter by items that have a tvdb id or not.</param>
|
/// <param name="hasTvdbId">Optional filter by items that have a TVDb id or not.</param>
|
||||||
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
||||||
/// <param name="isSeries">Optional filter for live tv series.</param>
|
/// <param name="isSeries">Optional filter for live tv series.</param>
|
||||||
/// <param name="isNews">Optional filter for live tv news.</param>
|
/// <param name="isNews">Optional filter for live tv news.</param>
|
||||||
|
@ -549,7 +549,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||||
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
||||||
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
||||||
/// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
|
/// <param name="sortOrder">Sort Order - Ascending, Descending.</param>
|
||||||
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
||||||
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
||||||
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
new InternalItemsQuery(user)
|
new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Person = name,
|
Person = name,
|
||||||
// Account for duplicates by imdb id, since the database doesn't support this yet
|
// Account for duplicates by IMDb id, since the database doesn't support this yet
|
||||||
Limit = itemLimit + 2,
|
Limit = itemLimit + 2,
|
||||||
PersonTypes = new[] { PersonType.Director },
|
PersonTypes = new[] { PersonType.Director },
|
||||||
IncludeItemTypes = itemTypes.ToArray(),
|
IncludeItemTypes = itemTypes.ToArray(),
|
||||||
|
@ -232,15 +232,15 @@ namespace Jellyfin.Api.Controllers
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Person = name,
|
Person = name,
|
||||||
// Account for duplicates by imdb id, since the database doesn't support this yet
|
// Account for duplicates by IMDb id, since the database doesn't support this yet
|
||||||
Limit = itemLimit + 2,
|
Limit = itemLimit + 2,
|
||||||
IncludeItemTypes = itemTypes.ToArray(),
|
IncludeItemTypes = itemTypes.ToArray(),
|
||||||
IsMovie = true,
|
IsMovie = true,
|
||||||
EnableGroupByMetadataKey = true,
|
EnableGroupByMetadataKey = true,
|
||||||
DtoOptions = dtoOptions
|
DtoOptions = dtoOptions
|
||||||
}).GroupBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
|
}).GroupBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
|
||||||
.Select(x => x.First())
|
.Select(x => x.First())
|
||||||
.Take(itemLimit)
|
.Take(itemLimit)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
@ -55,9 +55,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
/// <param name="minDateLastSavedForUser">Optional. The minimum last saved date for the current user. Format = ISO.</param>
|
||||||
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
/// <param name="maxPremiereDate">Optional. The maximum premiere date. Format = ISO.</param>
|
||||||
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
/// <param name="hasOverview">Optional filter by items that have an overview or not.</param>
|
||||||
/// <param name="hasImdbId">Optional filter by items that have an imdb id or not.</param>
|
/// <param name="hasImdbId">Optional filter by items that have an IMDb id or not.</param>
|
||||||
/// <param name="hasTmdbId">Optional filter by items that have a tmdb id or not.</param>
|
/// <param name="hasTmdbId">Optional filter by items that have a TMDb id or not.</param>
|
||||||
/// <param name="hasTvdbId">Optional filter by items that have a tvdb id or not.</param>
|
/// <param name="hasTvdbId">Optional filter by items that have a TVDb id or not.</param>
|
||||||
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
/// <param name="isMovie">Optional filter for live tv movies.</param>
|
||||||
/// <param name="isSeries">Optional filter for live tv series.</param>
|
/// <param name="isSeries">Optional filter for live tv series.</param>
|
||||||
/// <param name="isNews">Optional filter for live tv news.</param>
|
/// <param name="isNews">Optional filter for live tv news.</param>
|
||||||
|
@ -68,7 +68,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||||
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
/// <param name="recursive">When searching within folders, this determines whether or not the search will be recursive. true/false.</param>
|
||||||
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
/// <param name="searchTerm">Optional. Filter based on a search term.</param>
|
||||||
/// <param name="sortOrder">Sort Order - Ascending,Descending.</param>
|
/// <param name="sortOrder">Sort Order - Ascending, Descending.</param>
|
||||||
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
/// <param name="parentId">Specify this to localize the search to a specific item or folder. Omit to use the root.</param>
|
||||||
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
/// <param name="fields">Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines.</param>
|
||||||
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
/// <param name="excludeItemTypes">Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimited.</param>
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.Common.Providers
|
||||||
/// <returns>True if parsing was successful, false otherwise.</returns>
|
/// <returns>True if parsing was successful, false otherwise.</returns>
|
||||||
public static bool TryFindImdbId(ReadOnlySpan<char> text, out ReadOnlySpan<char> imdbId)
|
public static bool TryFindImdbId(ReadOnlySpan<char> text, out ReadOnlySpan<char> imdbId)
|
||||||
{
|
{
|
||||||
// imdb id is at least 9 chars (tt + 7 numbers)
|
// IMDb id is at least 9 chars (tt + 7 numbers)
|
||||||
while (text.Length >= 2 + ImdbMinNumbers)
|
while (text.Length >= 2 + ImdbMinNumbers)
|
||||||
{
|
{
|
||||||
var ttPos = text.IndexOf(ImdbPrefix);
|
var ttPos = text.IndexOf(ImdbPrefix);
|
||||||
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Common.Providers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip if more than 8 digits + 2 chars for tt
|
// Skip if more than 8 digits + 2 chars for tt
|
||||||
if (i <= ImdbMaxNumbers + 2 && i >= ImdbMinNumbers + 2)
|
if (i <= ImdbMaxNumbers + 2 && i >= ImdbMinNumbers + 2)
|
||||||
{
|
{
|
||||||
imdbId = text.Slice(0, i);
|
imdbId = text.Slice(0, i);
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the TMDB collection.
|
/// Gets or sets the name of the TMDb collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the TMDB collection.</value>
|
/// <value>The name of the TMDb collection.</value>
|
||||||
public string TmdbCollectionName { get; set; }
|
public string TmdbCollectionName { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IHasOrder.
|
||||||
|
/// </summary>
|
||||||
public interface IHasOrder
|
public interface IHasOrder
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the order.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The order.</value>
|
||||||
int Order { get; }
|
int Order { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -8,20 +6,41 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IRemoteMetadataProvider.
|
||||||
|
/// </summary>
|
||||||
public interface IRemoteMetadataProvider : IMetadataProvider
|
public interface IRemoteMetadataProvider : IMetadataProvider
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IRemoteMetadataProvider.
|
||||||
|
/// </summary>
|
||||||
public interface IRemoteMetadataProvider<TItemType, in TLookupInfoType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider, IRemoteSearchProvider<TLookupInfoType>
|
public interface IRemoteMetadataProvider<TItemType, in TLookupInfoType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider, IRemoteSearchProvider<TLookupInfoType>
|
||||||
where TItemType : BaseItem, IHasLookupInfo<TLookupInfoType>
|
where TItemType : BaseItem, IHasLookupInfo<TLookupInfoType>
|
||||||
where TLookupInfoType : ItemLookupInfo, new()
|
where TLookupInfoType : ItemLookupInfo, new()
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the metadata for a specific LookupInfoType.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info">The LookupInfoType to get metadata for.</param>
|
||||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
|
||||||
|
/// <returns>Task{MetadataResult{TItemType}}.</returns>
|
||||||
Task<MetadataResult<TItemType>> GetMetadata(TLookupInfoType info, CancellationToken cancellationToken);
|
Task<MetadataResult<TItemType>> GetMetadata(TLookupInfoType info, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface IRemoteMetadataProvider.
|
||||||
|
/// </summary>
|
||||||
public interface IRemoteSearchProvider<in TLookupInfoType> : IRemoteSearchProvider
|
public interface IRemoteSearchProvider<in TLookupInfoType> : IRemoteSearchProvider
|
||||||
where TLookupInfoType : ItemLookupInfo
|
where TLookupInfoType : ItemLookupInfo
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of <see cref="RemoteSearchResult"/> for a specific LookupInfoType.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="searchInfo">The LookupInfoType to search for.</param>
|
||||||
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
|
||||||
|
/// <returns>Task{IEnumerable{RemoteSearchResult}}.</returns>
|
||||||
Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TLookupInfoType searchInfo, CancellationToken cancellationToken);
|
Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TLookupInfoType searchInfo, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Entities
|
namespace MediaBrowser.Model.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14,38 +12,78 @@ namespace MediaBrowser.Model.Entities
|
||||||
Custom = 0,
|
Custom = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The imdb.
|
/// The IMDb id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Imdb = 2,
|
Imdb = 2,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The TMDB.
|
/// The TMDb id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Tmdb = 3,
|
Tmdb = 3,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The TVDB.
|
/// The TVDb id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Tvdb = 4,
|
Tvdb = 4,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The tvcom.
|
/// The tvcom id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Tvcom = 5,
|
Tvcom = 5,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tmdb Collection Id.
|
/// TMDb collection id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TmdbCollection = 7,
|
TmdbCollection = 7,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MusicBrainz album id.
|
||||||
|
/// </summary>
|
||||||
MusicBrainzAlbum = 8,
|
MusicBrainzAlbum = 8,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MusicBrainz album artist id.
|
||||||
|
/// </summary>
|
||||||
MusicBrainzAlbumArtist = 9,
|
MusicBrainzAlbumArtist = 9,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MusicBrainz artist id.
|
||||||
|
/// </summary>
|
||||||
MusicBrainzArtist = 10,
|
MusicBrainzArtist = 10,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MusicBrainz release group id.
|
||||||
|
/// </summary>
|
||||||
MusicBrainzReleaseGroup = 11,
|
MusicBrainzReleaseGroup = 11,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Zap2It id.
|
||||||
|
/// </summary>
|
||||||
Zap2It = 12,
|
Zap2It = 12,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The TvRage id.
|
||||||
|
/// </summary>
|
||||||
TvRage = 15,
|
TvRage = 15,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The AudioDb artist id.
|
||||||
|
/// </summary>
|
||||||
AudioDbArtist = 16,
|
AudioDbArtist = 16,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The AudioDb collection id.
|
||||||
|
/// </summary>
|
||||||
AudioDbAlbum = 17,
|
AudioDbAlbum = 17,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MusicBrainz track id.
|
||||||
|
/// </summary>
|
||||||
MusicBrainzTrack = 18,
|
MusicBrainzTrack = 18,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The TvMaze id.
|
||||||
|
/// </summary>
|
||||||
TvMaze = 19
|
TvMaze = 19
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ namespace MediaBrowser.Model.Querying
|
||||||
ProductionLocations,
|
ProductionLocations,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Imdb, tmdb, etc.
|
/// The ids from IMDb, TMDb, etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ProviderIds,
|
ProviderIds,
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// thetvdb will sometimes serve a rubbish 404 html page with a 200 OK code, because reasons...
|
// TVDb will sometimes serve a rubbish 404 html page with a 200 OK code, because reasons...
|
||||||
if (contentType.Equals(MediaTypeNames.Text.Html, StringComparison.OrdinalIgnoreCase))
|
if (contentType.Equals(MediaTypeNames.Text.Html, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
throw new HttpRequestException("Invalid image received.", null, HttpStatusCode.NotFound);
|
throw new HttpRequestException("Invalid image received.", null, HttpStatusCode.NotFound);
|
||||||
|
|
|
@ -8,7 +8,7 @@ using TMDbLib.Objects.General;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.Api
|
namespace MediaBrowser.Providers.Plugins.Tmdb.Api
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The TMDb api controller.
|
/// The TMDb API controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize(Policy = "DefaultAuthorization")]
|
[Authorize(Policy = "DefaultAuthorization")]
|
||||||
|
|
|
@ -7,7 +7,7 @@ using MediaBrowser.Model.Providers;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// External ID for a TMDB box set.
|
/// External id for a TMDb box set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TmdbBoxSetExternalId : IExternalId
|
public class TmdbBoxSetExternalId : IExternalId
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -18,26 +16,38 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// BoxSet image provider powered by TMDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbBoxSetImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbBoxSetImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbBoxSetImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbBoxSetImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbBoxSetImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public int Order => 0;
|
public int Order => 0;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public bool Supports(BaseItem item)
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is BoxSet;
|
return item is BoxSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
|
@ -47,6 +57,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = Convert.ToInt32(item.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
var tmdbId = Convert.ToInt32(item.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
||||||
|
@ -76,6 +87,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -18,12 +16,21 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// BoxSet provider powered by TMDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
public class TmdbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbBoxSetProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="libraryManager">The <see cref="ILibraryManager"/>.</param>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbBoxSetProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager, ILibraryManager libraryManager)
|
public TmdbBoxSetProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
|
@ -31,8 +38,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(BoxSetInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(BoxSetInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = Convert.ToInt32(searchInfo.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
var tmdbId = Convert.ToInt32(searchInfo.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
||||||
|
@ -81,6 +90,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
return collections;
|
return collections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<BoxSet>> GetMetadata(BoxSetInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<BoxSet>> GetMetadata(BoxSetInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = Convert.ToInt32(info.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
var tmdbId = Convert.ToInt32(info.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
||||||
|
@ -124,6 +134,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -7,7 +7,7 @@ using MediaBrowser.Model.Providers;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// External ID for a TMBD movie.
|
/// External id for a TMDb movie.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TmdbMovieExternalId : IExternalId
|
public class TmdbMovieExternalId : IExternalId
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -19,26 +17,38 @@ using TMDbLib.Objects.Find;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Movie image provider powered by TMDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbMovieImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbMovieImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbMovieImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbMovieImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbMovieImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public int Order => 0;
|
public int Order => 0;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public bool Supports(BaseItem item)
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is Trailer;
|
return item is Movie || item is Trailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
|
@ -49,6 +59,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
@ -96,6 +107,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -23,7 +21,7 @@ using TMDbLib.Objects.Search;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MovieDbProvider.
|
/// Movie provider powered by TMDb.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TmdbMovieProvider : IRemoteMetadataProvider<Movie, MovieInfo>, IHasOrder
|
public class TmdbMovieProvider : IRemoteMetadataProvider<Movie, MovieInfo>, IHasOrder
|
||||||
{
|
{
|
||||||
|
@ -31,6 +29,12 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbMovieProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="libraryManager">The <see cref="ILibraryManager"/>.</param>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbMovieProvider(
|
public TmdbMovieProvider(
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
TmdbClientManager tmdbClientManager,
|
TmdbClientManager tmdbClientManager,
|
||||||
|
@ -41,11 +45,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => TmdbUtils.ProviderName;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MovieInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MovieInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var id))
|
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var id))
|
||||||
|
@ -133,6 +139,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
return remoteSearchResults;
|
return remoteSearchResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
@ -144,7 +151,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
||||||
// Caller provides the filename with extension stripped and NOT the parsed filename
|
// Caller provides the filename with extension stripped and NOT the parsed filename
|
||||||
var parsedName = _libraryManager.ParseName(info.Name);
|
var parsedName = _libraryManager.ParseName(info.Name);
|
||||||
var cleanedName = TmdbUtils.CleanName(parsedName.Name);
|
var cleanedName = TmdbUtils.CleanName(parsedName.Name);
|
||||||
var searchResults = await _tmdbClientManager.SearchMovieAsync(cleanedName, info.Year ?? parsedName.Year ?? 0, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
var searchResults = await _tmdbClientManager.SearchMovieAsync(cleanedName, info.Year ?? parsedName.Year ?? 0, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults.Count > 0)
|
if (searchResults.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ using MediaBrowser.Model.Providers;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// External ID for a TMDB person.
|
/// External id for a TMDb person.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TmdbPersonExternalId : IExternalId
|
public class TmdbPersonExternalId : IExternalId
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -14,11 +12,19 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Person image provider powered by TMDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbPersonImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbPersonImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbPersonImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbPersonImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbPersonImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
|
@ -31,11 +37,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order => 0;
|
public int Order => 0;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public bool Supports(BaseItem item)
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is Person;
|
return item is Person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
|
@ -44,6 +52,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var person = (Person)item;
|
var person = (Person)item;
|
||||||
|
@ -68,6 +77,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -16,19 +14,29 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Person image provider powered by TMDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo>
|
public class TmdbPersonProvider : IRemoteMetadataProvider<Person, PersonLookupInfo>
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbPersonProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbPersonProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbPersonProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(PersonLookupInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(PersonLookupInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var personTmdbId))
|
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var personTmdbId))
|
||||||
|
@ -79,6 +87,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
return remoteSearchResults;
|
return remoteSearchResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<Person>> GetMetadata(PersonLookupInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var personTmdbId = Convert.ToInt32(info.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
var personTmdbId = Convert.ToInt32(info.GetProviderId(MetadataProvider.Tmdb), CultureInfo.InvariantCulture);
|
||||||
|
@ -131,6 +140,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.People
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -17,22 +15,38 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV episode iage provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbEpisodeImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbEpisodeImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbEpisodeImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbEpisodeImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbEpisodeImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After TheTvDb
|
/// <inheritdoc />
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool Supports(BaseItem item)
|
||||||
|
{
|
||||||
|
return item is Controller.Entities.TV.Episode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
|
@ -41,6 +55,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var episode = (Controller.Entities.TV.Episode)item;
|
var episode = (Controller.Entities.TV.Episode)item;
|
||||||
|
@ -81,14 +96,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(BaseItem item)
|
|
||||||
{
|
|
||||||
return item is Controller.Entities.TV.Episode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -19,22 +17,32 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV episode provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IHasOrder
|
public class TmdbEpisodeProvider : IRemoteMetadataProvider<Episode, EpisodeInfo>, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbEpisodeProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbEpisodeProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbEpisodeProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// After TheTvDb
|
/// <inheritdoc />
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
// The search query must either provide an episode number or date
|
// The search query must either provide an episode number or date
|
||||||
|
@ -68,6 +76,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var metadataResult = new MetadataResult<Episode>();
|
var metadataResult = new MetadataResult<Episode>();
|
||||||
|
@ -209,6 +218,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return metadataResult;
|
return metadataResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -16,26 +14,52 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV season image provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbSeasonImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbSeasonImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbSeasonImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
|
|
||||||
public TmdbSeasonImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbSeasonImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The order.
|
||||||
|
/// </summary>
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name.
|
||||||
|
/// </summary>
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
/// <inheritdoc />
|
||||||
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return item is Season;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
|
{
|
||||||
|
return new List<ImageType>
|
||||||
|
{
|
||||||
|
ImageType.Primary
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var season = (Season)item;
|
var season = (Season)item;
|
||||||
|
@ -68,17 +92,10 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
/// <inheritdoc />
|
||||||
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
{
|
|
||||||
ImageType.Primary
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Supports(BaseItem item)
|
|
||||||
{
|
|
||||||
return item is Season;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -17,19 +15,29 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV season provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbSeasonProvider : IRemoteMetadataProvider<Season, SeasonInfo>
|
public class TmdbSeasonProvider : IRemoteMetadataProvider<Season, SeasonInfo>
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbSeasonProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbSeasonProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbSeasonProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = new MetadataResult<Season>();
|
var result = new MetadataResult<Season>();
|
||||||
|
@ -114,11 +122,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeasonInfo searchInfo, CancellationToken cancellationToken)
|
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeasonInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return Task.FromResult(Enumerable.Empty<RemoteSearchResult>());
|
return Task.FromResult(Enumerable.Empty<RemoteSearchResult>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -6,7 +6,7 @@ using MediaBrowser.Model.Providers;
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// External ID for a TMDB series.
|
/// External id for a TMDb series.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TmdbSeriesExternalId : IExternalId
|
public class TmdbSeriesExternalId : IExternalId
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -16,27 +14,38 @@ using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV series image provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbSeriesImageProvider : IRemoteImageProvider, IHasOrder
|
public class TmdbSeriesImageProvider : IRemoteImageProvider, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbSeriesImageProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbSeriesImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbSeriesImageProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
// After tvdb and fanart
|
/// <inheritdoc />
|
||||||
public int Order => 2;
|
public int Order => 2;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public bool Supports(BaseItem item)
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is Series;
|
return item is Series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||||
{
|
{
|
||||||
return new List<ImageType>
|
return new List<ImageType>
|
||||||
|
@ -47,6 +56,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = item.GetProviderId(MetadataProvider.Tmdb);
|
var tmdbId = item.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
@ -80,6 +90,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return remoteImages;
|
return remoteImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -23,12 +21,21 @@ using TMDbLib.Objects.TvShows;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TV series provider powered by TheMovieDb.
|
||||||
|
/// </summary>
|
||||||
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
public class TmdbSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TmdbSeriesProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="libraryManager">The <see cref="ILibraryManager"/>.</param>
|
||||||
|
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
|
||||||
|
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</param>
|
||||||
public TmdbSeriesProvider(
|
public TmdbSeriesProvider(
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
IHttpClientFactory httpClientFactory,
|
IHttpClientFactory httpClientFactory,
|
||||||
|
@ -39,11 +46,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
|
|
||||||
// After TheTVDB
|
/// <inheritdoc />
|
||||||
public int Order => 1;
|
public int Order => 1;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var tmdbId))
|
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var tmdbId))
|
||||||
|
@ -159,6 +168,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
return remoteResult;
|
return remoteResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = new MetadataResult<Series>
|
var result = new MetadataResult<Series>
|
||||||
|
@ -383,6 +393,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
private static readonly Regex _nonWords = new(@"[\W_]+", RegexOptions.Compiled);
|
private static readonly Regex _nonWords = new(@"[\W_]+", RegexOptions.Compiled);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// URL of the TMDB instance to use.
|
/// URL of the TMDb instance to use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BaseTmdbUrl = "https://www.themoviedb.org/";
|
public const string BaseTmdbUrl = "https://www.themoviedb.org/";
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maps the TMDB provided roles for crew members to Jellyfin roles.
|
/// Maps the TMDb provided roles for crew members to Jellyfin roles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="crew">Crew member to map against the Jellyfin person types.</param>
|
/// <param name="crew">Crew member to map against the Jellyfin person types.</param>
|
||||||
/// <returns>The Jellyfin person type.</returns>
|
/// <returns>The Jellyfin person type.</returns>
|
||||||
|
@ -103,9 +103,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
|
|
||||||
languages.Add(preferredLanguage);
|
languages.Add(preferredLanguage);
|
||||||
|
|
||||||
if (preferredLanguage.Length == 5) // like en-US
|
if (preferredLanguage.Length == 5) // Like en-US
|
||||||
{
|
{
|
||||||
// Currently, TMDB supports 2-letter language codes only
|
// Currently, TMDb supports 2-letter language codes only.
|
||||||
// They are planning to change this in the future, thus we're
|
// They are planning to change this in the future, thus we're
|
||||||
// supplying both codes if we're having a 5-letter code.
|
// supplying both codes if we're having a 5-letter code.
|
||||||
languages.Add(preferredLanguage.Substring(0, 2));
|
languages.Add(preferredLanguage.Substring(0, 2));
|
||||||
|
@ -114,6 +114,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
|
|
||||||
languages.Add("null");
|
languages.Add("null");
|
||||||
|
|
||||||
|
// Always add English as fallback language
|
||||||
if (!string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
languages.Add("en");
|
languages.Add("en");
|
||||||
|
@ -134,14 +135,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
// They require this to be uppercase
|
// TMDb requires this to be uppercase
|
||||||
// Everything after the hyphen must be written in uppercase due to a way TMDB wrote their api.
|
// Everything after the hyphen must be written in uppercase due to a way TMDb wrote their API.
|
||||||
// See here: https://www.themoviedb.org/talk/5119221d760ee36c642af4ad?page=3#56e372a0c3a3685a9e0019ab
|
// See here: https://www.themoviedb.org/talk/5119221d760ee36c642af4ad?page=3#56e372a0c3a3685a9e0019ab
|
||||||
var parts = language.Split('-');
|
var parts = language.Split('-');
|
||||||
|
|
||||||
if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
{
|
{
|
||||||
// TMDB doesn't support Switzerland (de-CH, it-CH or fr-CH) so use the language (de, it or fr) without country code
|
// TMDb doesn't support Switzerland (de-CH, it-CH or fr-CH) so use the language (de, it or fr) without country code
|
||||||
if (string.Equals(parts[1], "CH", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(parts[1], "CH", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parts[0];
|
return parts[0];
|
||||||
|
@ -174,14 +175,14 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Combines the metadata country code and the parental rating from the Api into the value we store in our database.
|
/// Combines the metadata country code and the parental rating from the API into the value we store in our database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="countryCode">The Iso 3166-1 country code of the rating country.</param>
|
/// <param name="countryCode">The ISO 3166-1 country code of the rating country.</param>
|
||||||
/// <param name="ratingValue">The rating value returned by the Tmdb Api.</param>
|
/// <param name="ratingValue">The rating value returned by the TMDb API.</param>
|
||||||
/// <returns>The combined parental rating of country code+rating value.</returns>
|
/// <returns>The combined parental rating of country code+rating value.</returns>
|
||||||
public static string BuildParentalRating(string countryCode, string ratingValue)
|
public static string BuildParentalRating(string countryCode, string ratingValue)
|
||||||
{
|
{
|
||||||
// exclude US because we store us values as TV-14 without the country code.
|
// Exclude US because we store US values as TV-14 without the country code.
|
||||||
var ratingPrefix = string.Equals(countryCode, "US", StringComparison.OrdinalIgnoreCase) ? string.Empty : countryCode + "-";
|
var ratingPrefix = string.Equals(countryCode, "US", StringComparison.OrdinalIgnoreCase) ? string.Empty : countryCode + "-";
|
||||||
var newRating = ratingPrefix + ratingValue;
|
var newRating = ratingPrefix + ratingValue;
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
|
|
||||||
ParseProviderLinks(item.Item, endingXml);
|
ParseProviderLinks(item.Item, endingXml);
|
||||||
|
|
||||||
// If the file is just an imdb url, don't go any further
|
// If the file is just an IMDb url, don't go any further
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1136,21 +1136,21 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "rating":
|
case "rating":
|
||||||
{
|
|
||||||
if (reader.IsEmptyElement)
|
|
||||||
{
|
{
|
||||||
reader.Read();
|
if (reader.IsEmptyElement)
|
||||||
continue;
|
{
|
||||||
|
reader.Read();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ratingName = reader.GetAttribute("name");
|
||||||
|
|
||||||
|
using var subtree = reader.ReadSubtree();
|
||||||
|
FetchFromRatingNode(subtree, item, ratingName);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ratingName = reader.GetAttribute("name");
|
|
||||||
|
|
||||||
using var subtree = reader.ReadSubtree();
|
|
||||||
FetchFromRatingNode(subtree, item, ratingName);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user