diff --git a/Jellyfin.Plugin.Anime/Constants.cs b/Jellyfin.Plugin.Anime/Constants.cs
new file mode 100644
index 0000000..3b9e8a4
--- /dev/null
+++ b/Jellyfin.Plugin.Anime/Constants.cs
@@ -0,0 +1,7 @@
+namespace Jellyfin.Plugin.Anime
+{
+ static class Constants
+ {
+ public const string UserAgent = "jellyfin-plugin-anime";
+ }
+}
diff --git a/Jellyfin.Plugin.Anime/Jellyfin.Plugin.Anime.csproj b/Jellyfin.Plugin.Anime/Jellyfin.Plugin.Anime.csproj
index 435b116..3cb316a 100644
--- a/Jellyfin.Plugin.Anime/Jellyfin.Plugin.Anime.csproj
+++ b/Jellyfin.Plugin.Anime/Jellyfin.Plugin.Anime.csproj
@@ -3,8 +3,8 @@
netstandard2.0
Jellyfin.Plugin.Anime
- 4.0.0
- 4.0.0
+ 5.0.0
+ 5.0.0
diff --git a/Jellyfin.Plugin.Anime/Providers/AniDB/Identity/AniDbTitleDownloader.cs b/Jellyfin.Plugin.Anime/Providers/AniDB/Identity/AniDbTitleDownloader.cs
index 7a7306a..3041026 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniDB/Identity/AniDbTitleDownloader.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniDB/Identity/AniDbTitleDownloader.cs
@@ -18,7 +18,7 @@ public class AniDbTitleDownloader : IAniDbTitleDownloader
///
/// The URL for retrieving a list of all anime titles and their AniDB IDs.
///
- private const string TitlesUrl = "http://anidb.net/api/animetitles.xml.gz";
+ private const string TitlesUrl = "http://anidb.net/api/anime-titles.xml.gz";
private readonly IApplicationPaths _paths;
private readonly ILogger _logger;
@@ -79,17 +79,7 @@ public async Task Load(CancellationToken cancellationToken)
private async Task DownloadTitles(string titlesFile)
{
_logger.LogDebug("Downloading new AniDB titles file.");
-
- var client = new WebClient();
-
- await AniDbSeriesProvider.RequestLimiter.Tick().ConfigureAwait(false);
- await Task.Delay(Plugin.Instance.Configuration.AniDB_wait_time).ConfigureAwait(false);
- using (var stream = await client.OpenReadTaskAsync(TitlesUrl))
- using (var unzipped = new GZipStream(stream, CompressionMode.Decompress))
- using (var writer = File.Open(titlesFile, FileMode.Create, FileAccess.Write))
- {
- await unzipped.CopyToAsync(writer).ConfigureAwait(false);
- }
+ await DownloadTitles_static(titlesFile);
}
///
@@ -101,6 +91,7 @@ private async Task DownloadTitles(string titlesFile)
private static async Task DownloadTitles_static(string titlesFile)
{
var client = new WebClient();
+ client.Headers.Add("User-Agent", Constants.UserAgent);
await AniDbSeriesProvider.RequestLimiter.Tick().ConfigureAwait(false);
await Task.Delay(Plugin.Instance.Configuration.AniDB_wait_time).ConfigureAwait(false);
diff --git a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbEpisodeProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbEpisodeProvider.cs
index 3c3aee9..75201b4 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbEpisodeProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbEpisodeProvider.cs
@@ -154,7 +154,8 @@ await AniDbSeriesProvider.GetSeriesData(
public Task GetImageResponse(string url, CancellationToken cancellationToken)
{
- throw new NotImplementedException();
+ var imageProvider = new AniDbImageProvider(_httpClient, _configurationManager.ApplicationPaths);
+ return imageProvider.GetImageResponse(url, cancellationToken);
}
private async Task ParseAdditionalEpisodeXml(FileInfo xml, Episode episode, string metadataLanguage)
diff --git a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbImageProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbImageProvider.cs
index c1e169b..42cb114 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbImageProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbImageProvider.cs
@@ -33,6 +33,7 @@ public async Task GetImageResponse(string url, CancellationTok
return await _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
}).ConfigureAwait(false);
diff --git a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbPersonProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbPersonProvider.cs
index 015902d..00755c8 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbPersonProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbPersonProvider.cs
@@ -102,6 +102,7 @@ public async Task GetImageResponse(string url, CancellationTok
return await _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
}).ConfigureAwait(false);
diff --git a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbSeriesProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbSeriesProvider.cs
index 9ad84a5..18643ce 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbSeriesProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniDB/Metadata/AniDbSeriesProvider.cs
@@ -95,11 +95,15 @@ public async Task> GetSearchResults(SeriesInfo s
if (metadata.HasMetadata)
{
+ var seriesId = metadata.Item.ProviderIds.GetOrDefault(ProviderNames.AniDb);
+ var imageProvider = new AniDbImageProvider(_httpClient, _appPaths);
+ var images = await imageProvider.GetImages(seriesId, cancellationToken);
var res = new RemoteSearchResult
{
Name = metadata.Item.Name,
PremiereDate = metadata.Item.PremiereDate,
ProductionYear = metadata.Item.ProductionYear,
+ ImageUrl = images.Any() ? images.First().Url : null,
ProviderIds = metadata.Item.ProviderIds,
SearchProviderName = Name
};
@@ -114,6 +118,7 @@ public Task GetImageResponse(string url, CancellationToken can
{
return _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
});
@@ -518,6 +523,7 @@ private static async Task DownloadSeriesData(string aid, string seriesDataPath,
var requestOptions = new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
Url = string.Format(SeriesQueryUrl, ClientName, aid),
CancellationToken = cancellationToken
};
diff --git a/Jellyfin.Plugin.Anime/Providers/AniList/AniListApi.cs b/Jellyfin.Plugin.Anime/Providers/AniList/AniListApi.cs
index 7444ec0..be42b1e 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniList/AniListApi.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniList/AniListApi.cs
@@ -371,6 +371,7 @@ public async Task WebRequestAPI(string link)
string _strContent = "";
using (WebClient client = new WebClient())
{
+ client.Headers.Add("User-Agent", Constants.UserAgent);
var values = new System.Collections.Specialized.NameValueCollection();
var response = await Task.Run(() => client.UploadValues(new Uri(link),values));
diff --git a/Jellyfin.Plugin.Anime/Providers/AniList/AniListSeriesProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniList/AniListSeriesProvider.cs
index 71bed51..b210296 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniList/AniListSeriesProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniList/AniListSeriesProvider.cs
@@ -106,6 +106,7 @@ public Task GetImageResponse(string url, CancellationToken can
{
return _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
});
@@ -160,6 +161,7 @@ public Task GetImageResponse(string url, CancellationToken can
{
return _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
});
diff --git a/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchApi.cs b/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchApi.cs
index b05d69b..4c35bc9 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchApi.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchApi.cs
@@ -297,6 +297,7 @@ public static async Task WebRequestAPI(string link)
string _strContent = "";
using (WebClient client = new WebClient())
{
+ client.Headers.Add("User-Agent", Constants.UserAgent);
Task async_content = client.DownloadStringTaskAsync(link);
_strContent = await async_content;
}
diff --git a/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchSeriesProvider.cs b/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchSeriesProvider.cs
index 7713752..a39cb1b 100644
--- a/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchSeriesProvider.cs
+++ b/Jellyfin.Plugin.Anime/Providers/AniSearch/AniSearchSeriesProvider.cs
@@ -98,6 +98,7 @@ public Task GetImageResponse(string url, CancellationToken can
{
return _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
});
@@ -151,6 +152,7 @@ public Task GetImageResponse(string url, CancellationToken can
{
return _httpClient.GetResponse(new HttpRequestOptions
{
+ UserAgent = Constants.UserAgent,
CancellationToken = cancellationToken,
Url = url
});
diff --git a/build.yaml b/build.yaml
index 41677ce..7f28dfa 100644
--- a/build.yaml
+++ b/build.yaml
@@ -1,7 +1,7 @@
---
name: "jellyfin-plugin-anime"
guid: "a4df60c5-6ab4-412a-8f79-2cab93fb2bc5"
-version: "4"
+version: "5"
jellyfin_version: "10.3.0"
owner: "jellyfin"
nicename: "Anime"