mirror of https://github.com/jellyfin/jellyfin.git
Add xmldocs for studio image provider
This commit is contained in:
parent
072651c4be
commit
4b1654ae3b
|
@ -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,50 @@ 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";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -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>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 images for a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="file">The file.</param>
|
||||||
|
/// <returns>IEnumerable{string}.</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);
|
||||||
|
|
Loading…
Reference in New Issue