-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Plugin.cs
56 lines (49 loc) · 1.7 KB
/
Plugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using Jellyfin.Plugin.AniList.Configuration;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
namespace Jellyfin.Plugin.AniList
{
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
{
IHttpClientFactory _httpClientFactory;
public Plugin(
IApplicationPaths applicationPaths,
IXmlSerializer xmlSerializer,
IHttpClientFactory httpClientFactory)
: base(applicationPaths, xmlSerializer)
{
Instance = this;
_httpClientFactory = httpClientFactory;
}
public HttpClient GetHttpClient() {
var httpClient = _httpClientFactory.CreateClient(NamedClient.Default);
httpClient.DefaultRequestHeaders.UserAgent.Add(
new ProductInfoHeaderValue(Name, Version.ToString()));
return httpClient;
}
/// <inheritdoc />
public override string Name => Constants.PluginName;
/// <inheritdoc />
public override Guid Id => Guid.Parse(Constants.PluginGuid);
public static Plugin Instance { get; private set; }
/// <inheritdoc />
public IEnumerable<PluginPageInfo> GetPages()
{
return new[]
{
new PluginPageInfo
{
Name = Name,
EmbeddedResourcePath = string.Format("{0}.Configuration.configPage.html", GetType().Namespace)
}
};
}
}
}