Apply review suggestions

pull/7602/head
Shadowghost 3 years ago
parent 4b1654ae3b
commit 2e639c77c7

@ -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 (wither 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))

@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Providers
/// </summary> /// </summary>
/// <param name="info">The LookupInfoType to get metadata for.</param> /// <param name="info">The LookupInfoType to get metadata for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
/// <returns>Task{MetadataResult{TItemType}}.</returns> /// <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);
} }
@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Providers
/// </summary> /// </summary>
/// <param name="searchInfo">The LookupInfoType to search for.</param> /// <param name="searchInfo">The LookupInfoType to search for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
/// <returns>Task{IEnumerable{RemoteSearchResult}}.</returns> /// <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);
} }
} }

@ -12,77 +12,77 @@ namespace MediaBrowser.Model.Entities
Custom = 0, Custom = 0,
/// <summary> /// <summary>
/// The IMDb id. /// The IMDb provider.
/// </summary> /// </summary>
Imdb = 2, Imdb = 2,
/// <summary> /// <summary>
/// The TMDb id. /// The TMDb provider.
/// </summary> /// </summary>
Tmdb = 3, Tmdb = 3,
/// <summary> /// <summary>
/// The TVDb id. /// The TVDb provider.
/// </summary> /// </summary>
Tvdb = 4, Tvdb = 4,
/// <summary> /// <summary>
/// The tvcom id. /// The tvcom providerd.
/// </summary> /// </summary>
Tvcom = 5, Tvcom = 5,
/// <summary> /// <summary>
/// TMDb collection id. /// TMDb collection provider.
/// </summary> /// </summary>
TmdbCollection = 7, TmdbCollection = 7,
/// <summary> /// <summary>
/// The MusicBrainz album id. /// The MusicBrainz album provider.
/// </summary> /// </summary>
MusicBrainzAlbum = 8, MusicBrainzAlbum = 8,
/// <summary> /// <summary>
/// The MusicBrainz album artist id. /// The MusicBrainz album artist provider.
/// </summary> /// </summary>
MusicBrainzAlbumArtist = 9, MusicBrainzAlbumArtist = 9,
/// <summary> /// <summary>
/// The MusicBrainz artist id. /// The MusicBrainz artist provider.
/// </summary> /// </summary>
MusicBrainzArtist = 10, MusicBrainzArtist = 10,
/// <summary> /// <summary>
/// The MusicBrainz release group id. /// The MusicBrainz release group provider.
/// </summary> /// </summary>
MusicBrainzReleaseGroup = 11, MusicBrainzReleaseGroup = 11,
/// <summary> /// <summary>
/// The Zap2It id. /// The Zap2It provider.
/// </summary> /// </summary>
Zap2It = 12, Zap2It = 12,
/// <summary> /// <summary>
/// The TvRage id. /// The TvRage provider.
/// </summary> /// </summary>
TvRage = 15, TvRage = 15,
/// <summary> /// <summary>
/// The AudioDb artist id. /// The AudioDb artist provider.
/// </summary> /// </summary>
AudioDbArtist = 16, AudioDbArtist = 16,
/// <summary> /// <summary>
/// The AudioDb collection id. /// The AudioDb collection provider.
/// </summary> /// </summary>
AudioDbAlbum = 17, AudioDbAlbum = 17,
/// <summary> /// <summary>
/// The MusicBrainz track id. /// The MusicBrainz track provider.
/// </summary> /// </summary>
MusicBrainzTrack = 18, MusicBrainzTrack = 18,
/// <summary> /// <summary>
/// The TvMaze id. /// The TvMaze provider.
/// </summary> /// </summary>
TvMaze = 19 TvMaze = 19
} }

@ -50,10 +50,7 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
/// <inheritdoc/> /// <inheritdoc/>
public override string ConfigurationFileName => "Jellyfin.Plugin.StudioImages.xml"; public override string ConfigurationFileName => "Jellyfin.Plugin.StudioImages.xml";
/// <summary> /// <inheritdoc/>
/// Return the plugin configuration page.
/// </summary>
/// <returns>PluginPageInfo.</returns>
public IEnumerable<PluginPageInfo> GetPages() public IEnumerable<PluginPageInfo> GetPages()
{ {
yield return new PluginPageInfo yield return new PluginPageInfo

@ -122,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);
@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
/// </summary> /// </summary>
/// <param name="item">The <see cref="BaseItem"/>.</param> /// <param name="item">The <see cref="BaseItem"/>.</param>
/// <param name="images">The enumerable of image strings.</param> /// <param name="images">The enumerable of image strings.</param>
/// <returns>String.</returns> /// <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);
@ -170,10 +170,10 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
} }
/// <summary> /// <summary>
/// Get available images for a file. /// Get available image strings for a file.
/// </summary> /// </summary>
/// <param name="file">The file.</param> /// <param name="file">The file.</param>
/// <returns>IEnumerable{string}.</returns> /// <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);

@ -16,7 +16,7 @@ using MediaBrowser.Model.Providers;
namespace MediaBrowser.Providers.Plugins.Tmdb.TV namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{ {
/// <summary> /// <summary>
/// TV episode iage provider powered by TheMovieDb. /// TV episode image provider powered by TheMovieDb.
/// </summary> /// </summary>
public class TmdbEpisodeImageProvider : IRemoteImageProvider, IHasOrder public class TmdbEpisodeImageProvider : IRemoteImageProvider, IHasOrder
{ {

@ -27,21 +27,16 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
/// </summary> /// </summary>
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param> /// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/>.</param>
/// <param name="tmdbClientManager">The <see cref="TmdbClientManager"/>.</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> /// <inheritdoc/>
/// The order.
/// </summary>
public int Order => 1; public int Order => 1;
/// <summary> /// <inheritdoc/>
/// The name.
/// </summary>
public string Name => TmdbUtils.ProviderName; public string Name => TmdbUtils.ProviderName;
/// <inheritdoc /> /// <inheritdoc />

@ -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)
@ -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;
@ -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