Merge pull request #7602 from Shadowghost/provider-xmldoc

pull/8775/head
Bond-009 2 years ago committed by GitHub
commit 32fc46eb6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 (whether 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>A task returning a MetadataResult for the specific LookupInfoType.</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>A task returning RemoteSearchResults for the searchInfo.</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 provider.
/// </summary> /// </summary>
Imdb = 2, Imdb = 2,
/// <summary> /// <summary>
/// The TMDB. /// The TMDb provider.
/// </summary> /// </summary>
Tmdb = 3, Tmdb = 3,
/// <summary> /// <summary>
/// The TVDB. /// The TVDb provider.
/// </summary> /// </summary>
Tvdb = 4, Tvdb = 4,
/// <summary> /// <summary>
/// The tvcom. /// The tvcom providerd.
/// </summary> /// </summary>
Tvcom = 5, Tvcom = 5,
/// <summary> /// <summary>
/// Tmdb Collection Id. /// TMDb collection provider.
/// </summary> /// </summary>
TmdbCollection = 7, TmdbCollection = 7,
/// <summary>
/// The MusicBrainz album provider.
/// </summary>
MusicBrainzAlbum = 8, MusicBrainzAlbum = 8,
/// <summary>
/// The MusicBrainz album artist provider.
/// </summary>
MusicBrainzAlbumArtist = 9, MusicBrainzAlbumArtist = 9,
/// <summary>
/// The MusicBrainz artist provider.
/// </summary>
MusicBrainzArtist = 10, MusicBrainzArtist = 10,
/// <summary>
/// The MusicBrainz release group provider.
/// </summary>
MusicBrainzReleaseGroup = 11, MusicBrainzReleaseGroup = 11,
/// <summary>
/// The Zap2It provider.
/// </summary>
Zap2It = 12, Zap2It = 12,
/// <summary>
/// The TvRage provider.
/// </summary>
TvRage = 15, TvRage = 15,
/// <summary>
/// The AudioDb artist provider.
/// </summary>
AudioDbArtist = 16, AudioDbArtist = 16,
/// <summary>
/// The AudioDb collection provider.
/// </summary>
AudioDbAlbum = 17, AudioDbAlbum = 17,
/// <summary>
/// The MusicBrainz track provider.
/// </summary>
MusicBrainzTrack = 18, MusicBrainzTrack = 18,
/// <summary>
/// The TvMaze provider.
/// </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);

@ -1,13 +1,17 @@
#pragma warning disable CS1591 using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Plugins;
namespace MediaBrowser.Providers.Plugins.StudioImages.Configuration namespace MediaBrowser.Providers.Plugins.StudioImages.Configuration
{ {
/// <summary>
/// Plugin configuration class for the studio image provider.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration public class PluginConfiguration : BasePluginConfiguration
{ {
private string _repository = Plugin.DefaultServer; private string _repository = Plugin.DefaultServer;
/// <summary>
/// Gets or sets the studio image repository URL.
/// </summary>
public string RepositoryUrl public string RepositoryUrl
{ {
get get

@ -1,5 +1,4 @@
#nullable disable #nullable disable
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -11,27 +10,47 @@ using MediaBrowser.Providers.Plugins.StudioImages.Configuration;
namespace MediaBrowser.Providers.Plugins.StudioImages namespace MediaBrowser.Providers.Plugins.StudioImages
{ {
/// <summary>
/// Artwork Plugin class.
/// </summary>
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
{ {
/// <summary>
/// Artwork repository URL.
/// </summary>
public const string DefaultServer = "https://raw.github.com/jellyfin/emby-artwork/master/studios"; public const string DefaultServer = "https://raw.github.com/jellyfin/emby-artwork/master/studios";
/// <summary>
/// Initializes a new instance of the <see cref="Plugin"/> class.
/// </summary>
/// <param name="applicationPaths">application paths.</param>
/// <param name="xmlSerializer">xml serializer.</param>
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
: base(applicationPaths, xmlSerializer) : base(applicationPaths, xmlSerializer)
{ {
Instance = this; Instance = this;
} }
/// <summary>
/// Gets the instance of Artwork plugin.
/// </summary>
public static Plugin Instance { get; private set; } public static Plugin Instance { get; private set; }
/// <inheritdoc/>
public override Guid Id => new Guid("872a7849-1171-458d-a6fb-3de3d442ad30"); public override Guid Id => new Guid("872a7849-1171-458d-a6fb-3de3d442ad30");
/// <inheritdoc/>
public override string Name => "Studio Images"; public override string Name => "Studio Images";
/// <inheritdoc/>
public override string Description => "Get artwork for studios from any Jellyfin-compatible repository."; public override string Description => "Get artwork for studios from any Jellyfin-compatible repository.";
// TODO remove when plugin removed from server. // TODO remove when plugin removed from server.
/// <inheritdoc/>
public override string ConfigurationFileName => "Jellyfin.Plugin.StudioImages.xml"; public override string ConfigurationFileName => "Jellyfin.Plugin.StudioImages.xml";
/// <inheritdoc/>
public IEnumerable<PluginPageInfo> GetPages() public IEnumerable<PluginPageInfo> GetPages()
{ {
yield return new PluginPageInfo yield return new PluginPageInfo

@ -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;
@ -21,12 +19,21 @@ using MediaBrowser.Model.Providers;
namespace MediaBrowser.Providers.Plugins.StudioImages namespace MediaBrowser.Providers.Plugins.StudioImages
{ {
/// <summary>
/// Studio image provider.
/// </summary>
public class StudiosImageProvider : IRemoteImageProvider public class StudiosImageProvider : IRemoteImageProvider
{ {
private readonly IServerConfigurationManager _config; private readonly IServerConfigurationManager _config;
private readonly IHttpClientFactory _httpClientFactory; private readonly IHttpClientFactory _httpClientFactory;
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
/// <summary>
/// Initializes a new instance of the <see cref="StudiosImageProvider"/> class.
/// </summary>
/// <param name="config">The <see cref="IServerConfigurationManager"/>.</param>
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
/// <param name="fileSystem">The <see cref="IFileSystem"/>.</param>
public StudiosImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IFileSystem fileSystem) public StudiosImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IFileSystem fileSystem)
{ {
_config = config; _config = config;
@ -34,13 +41,16 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
_fileSystem = fileSystem; _fileSystem = fileSystem;
} }
/// <inheritdoc />
public string Name => "Artwork Repository"; public string Name => "Artwork Repository";
/// <inheritdoc />
public bool Supports(BaseItem item) public bool Supports(BaseItem item)
{ {
return item is Studio; return item is Studio;
} }
/// <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.StudioImages
}; };
} }
/// <inheritdoc />
public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken) public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
{ {
var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt"); var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt");
@ -103,6 +114,7 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
return EnsureList(url, file, _fileSystem, cancellationToken); return EnsureList(url, file, _fileSystem, cancellationToken);
} }
/// <inheritdoc />
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken) public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
{ {
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default); var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
@ -110,13 +122,13 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
} }
/// <summary> /// <summary>
/// Ensures the list. /// Ensures the existence of a file listing.
/// </summary> /// </summary>
/// <param name="url">The URL.</param> /// <param name="url">The URL.</param>
/// <param name="file">The file.</param> /// <param name="file">The file.</param>
/// <param name="fileSystem">The file system.</param> /// <param name="fileSystem">The file system.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>A Task to ensure existence of a file listing.</returns>
public async Task<string> EnsureList(string url, string file, IFileSystem fileSystem, CancellationToken cancellationToken) public async Task<string> EnsureList(string url, string file, IFileSystem fileSystem, CancellationToken cancellationToken)
{ {
var fileInfo = fileSystem.GetFileInfo(file); var fileInfo = fileSystem.GetFileInfo(file);
@ -134,6 +146,12 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
return file; return file;
} }
/// <summary>
/// Get matching image for an item.
/// </summary>
/// <param name="item">The <see cref="BaseItem"/>.</param>
/// <param name="images">The enumerable of image strings.</param>
/// <returns>The matching image string.</returns>
public string FindMatch(BaseItem item, IEnumerable<string> images) public string FindMatch(BaseItem item, IEnumerable<string> images)
{ {
var name = GetComparableName(item.Name); var name = GetComparableName(item.Name);
@ -151,6 +169,11 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
.Replace("/", string.Empty, StringComparison.Ordinal); .Replace("/", string.Empty, StringComparison.Ordinal);
} }
/// <summary>
/// Get available image strings for a file.
/// </summary>
/// <param name="file">The file.</param>
/// <returns>All images strings of a file.</returns>
public IEnumerable<string> GetAvailableImages(string file) public IEnumerable<string> GetAvailableImages(string file)
{ {
using var fileStream = File.OpenRead(file); using var fileStream = File.OpenRead(file);

@ -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 image 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,47 @@ 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;
} }
/// <inheritdoc/>
public int Order => 1; public int Order => 1;
/// <inheritdoc/>
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 +87,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>
{
ImageType.Primary
};
}
public bool Supports(BaseItem item)
{ {
return item is Season; 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;
@ -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;

@ -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;
@ -23,6 +21,10 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.XbmcMetadata.Parsers namespace MediaBrowser.XbmcMetadata.Parsers
{ {
/// <summary>
/// The BaseNfoParser class.
/// </summary>
/// <typeparam name="T">The type.</typeparam>
public class BaseNfoParser<T> public class BaseNfoParser<T>
where T : BaseItem where T : BaseItem
{ {
@ -63,16 +65,22 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// </summary> /// </summary>
protected ILogger Logger { get; } protected ILogger Logger { get; }
/// <summary>
/// Gets the provider manager.
/// </summary>
protected IProviderManager ProviderManager { get; } protected IProviderManager ProviderManager { get; }
/// <summary>
/// Gets a value indicating whether URLs after a closing XML tag are supporrted.
/// </summary>
protected virtual bool SupportsUrlAfterClosingXmlTag => false; protected virtual bool SupportsUrlAfterClosingXmlTag => false;
/// <summary> /// <summary>
/// Fetches metadata for an item from one xml file. /// Fetches metadata for an item from one xml file.
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The <see cref="MetadataResult{T}"/>.</param>
/// <param name="metadataFile">The metadata file.</param> /// <param name="metadataFile">The metadata file.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
/// <exception cref="ArgumentNullException"><c>item</c> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException"><c>item</c> is <c>null</c>.</exception>
/// <exception cref="ArgumentException"><c>metadataFile</c> is <c>null</c> or empty.</exception> /// <exception cref="ArgumentException"><c>metadataFile</c> is <c>null</c> or empty.</exception>
public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken) public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken)
@ -111,10 +119,10 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// <summary> /// <summary>
/// Fetches the specified item. /// Fetches the specified item.
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The <see cref="MetadataResult{T}"/>.</param>
/// <param name="metadataFile">The metadata file.</param> /// <param name="metadataFile">The metadata file.</param>
/// <param name="settings">The settings.</param> /// <param name="settings">The <see cref="XmlReaderSettings"/>.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
protected virtual void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken) protected virtual void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken)
{ {
if (!SupportsUrlAfterClosingXmlTag) if (!SupportsUrlAfterClosingXmlTag)
@ -170,7 +178,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;
@ -216,6 +224,11 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
} }
/// <summary>
/// Parses a XML tag to a provider id.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="xml">The xml tag.</param>
protected void ParseProviderLinks(T item, ReadOnlySpan<char> xml) protected void ParseProviderLinks(T item, ReadOnlySpan<char> xml)
{ {
if (ProviderIdParsers.TryFindImdbId(xml, out var imdbId)) if (ProviderIdParsers.TryFindImdbId(xml, out var imdbId))
@ -245,6 +258,11 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
} }
/// <summary>
/// Fetches metadata from an XML node.
/// </summary>
/// <param name="reader">The <see cref="XmlReader"/>.</param>
/// <param name="itemResult">The <see cref="MetadataResult{T}"/>.</param>
protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> itemResult) protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> itemResult)
{ {
var item = itemResult.Item; var item = itemResult.Item;
@ -1100,17 +1118,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
switch (reader.Name) switch (reader.Name)
{ {
case "language": case "language":
_ = reader.ReadElementContentAsString();
if (item is Video video)
{ {
_ = reader.ReadElementContentAsString(); video.HasSubtitles = true;
if (item is Video video)
{
video.HasSubtitles = true;
}
break;
} }
break;
default: default:
reader.Skip(); reader.Skip();
break; break;
@ -1136,20 +1151,20 @@ 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"); var ratingName = reader.GetAttribute("name");
using var subtree = reader.ReadSubtree(); using var subtree = reader.ReadSubtree();
FetchFromRatingNode(subtree, item, ratingName); FetchFromRatingNode(subtree, item, ratingName);
break; break;
} }
default: default:
reader.Skip(); reader.Skip();
@ -1210,9 +1225,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
/// <summary> /// <summary>
/// Gets the persons from XML node. /// Gets the persons from a XML node.
/// </summary> /// </summary>
/// <param name="reader">The reader.</param> /// <param name="reader">The <see cref="XmlReader"/>.</param>
/// <returns>IEnumerable{PersonInfo}.</returns> /// <returns>IEnumerable{PersonInfo}.</returns>
private PersonInfo GetPersonFromXmlNode(XmlReader reader) private PersonInfo GetPersonFromXmlNode(XmlReader reader)
{ {
@ -1348,10 +1363,10 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
/// <summary> /// <summary>
/// Parses the ImageType from the nfo aspect property. /// Parses the <see cref="ImageType"/> from the NFO aspect property.
/// </summary> /// </summary>
/// <param name="aspect">The nfo aspect property.</param> /// <param name="aspect">The NFO aspect property.</param>
/// <returns>The image type.</returns> /// <returns>The <see cref="ImageType"/>.</returns>
private static ImageType GetImageType(string aspect) private static ImageType GetImageType(string aspect)
{ {
return aspect switch return aspect switch

Loading…
Cancel
Save