61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using Jellyfin.Plugin.JRay.Configuration;
|
|
using Jellyfin.Plugin.JRay.Services;
|
|
using MediaBrowser.Common.Configuration;
|
|
using MediaBrowser.Common.Plugins;
|
|
using MediaBrowser.Model.Plugins;
|
|
using MediaBrowser.Model.Serialization;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Jellyfin.Plugin.JRay;
|
|
|
|
/// <summary>
|
|
/// The main plugin.
|
|
/// </summary>
|
|
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
|
{
|
|
private readonly ILogger<Plugin> _logger;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Plugin"/> class.
|
|
/// </summary>
|
|
/// <param name="applicationPaths">Instance of the <see cref="IApplicationPaths"/> interface.</param>
|
|
/// <param name="xmlSerializer">Instance of the <see cref="IXmlSerializer"/> interface.</param>
|
|
/// <param name="logger">The logger.</param>
|
|
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, ILogger<Plugin> logger)
|
|
: base(applicationPaths, xmlSerializer)
|
|
{
|
|
Instance = this;
|
|
_logger = logger;
|
|
|
|
WebClientPatchService.Apply(ApplicationPaths, Configuration.EnableOverlay, _logger);
|
|
ConfigurationChanged += (_, _) => WebClientPatchService.Apply(ApplicationPaths, Configuration.EnableOverlay, _logger);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override string Name => "JRay";
|
|
|
|
/// <inheritdoc />
|
|
public override Guid Id => Guid.Parse("96a22d9d-23fd-49bb-8970-5e153817d223");
|
|
|
|
/// <summary>
|
|
/// Gets the current plugin instance.
|
|
/// </summary>
|
|
public static Plugin? Instance { get; private set; }
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<PluginPageInfo> GetPages()
|
|
{
|
|
return
|
|
[
|
|
new PluginPageInfo
|
|
{
|
|
Name = Name,
|
|
EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace)
|
|
}
|
|
];
|
|
}
|
|
}
|