From 93037c2086e012fad30f1a8379f19493e2e535df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=9D=E7=A5=9E?= <45256288+chu-shen@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:04:11 +0800 Subject: [PATCH] fix: fix --- .github/workflows/build.yaml | 30 ++++++++++++++----- .github/workflows/release.yaml | 18 ----------- .../Providers/AniList/AniListApi.cs | 22 ++------------ .../Providers/AniList/AniListHelper.cs | 2 +- .../Providers/AniList/AniListMovieProvider.cs | 8 ++--- .../AniList/AniListSeriesProvider.cs | 6 ++-- README.md | 3 ++ 7 files changed, 35 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bfb715c..34a33ed 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,18 +4,32 @@ on: workflow_dispatch: push: branches: - - master - AnitomySharp - paths-ignore: - - '**/*.md' pull_request: - branches: - - master - - AnitomySharp - paths-ignore: - - '**/*.md' +permissions: + contents: write + pull-requests: write jobs: call: uses: jellyfin/jellyfin-meta-plugins/.github/workflows/build.yaml@master + + release-please: + needs: call + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v4.1.8 + with: + name: build-artifact + - uses: googleapis/release-please-action@v4 + id: release + with: + release-type: simple + - name: Upload Release Artifact + if: ${{ steps.release.outputs.release_created }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: + gh release upload ${{ steps.release.outputs.tag_name }} anilist_9.0.0.0.zip diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 083a021..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - branches: - - AnitomySharp - -permissions: - contents: write - pull-requests: write - -name: release-please - -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: googleapis/release-please-action@v4 - with: - release-type: simple \ No newline at end of file diff --git a/Jellyfin.Plugin.AniList/Providers/AniList/AniListApi.cs b/Jellyfin.Plugin.AniList/Providers/AniList/AniListApi.cs index 2c0ad8c..2c4f3e5 100644 --- a/Jellyfin.Plugin.AniList/Providers/AniList/AniListApi.cs +++ b/Jellyfin.Plugin.AniList/Providers/AniList/AniListApi.cs @@ -231,29 +231,13 @@ public async Task Search_GetSeries(string title, Cancellation public async Task Search_GetSeries(string title, string year, CancellationToken cancellationToken) { // Reimplemented instead of calling Search_GetSeries_list() for efficiency - RootObject WebContent = await WebRequestAPI(SearchLink.Replace("{0}", title)); - foreach (MediaSearchResult media in WebContent.data.Page.media) + var medias = await Search_GetSeries_list(title, cancellationToken).ConfigureAwait(false); + foreach (MediaSearchResult media in medias) { if (media.startDate.year == int.Parse(year)) return media; } - foreach (MediaSearchResult media in WebContent.data.Page.media) - { - return media; - } - return null; - } - - public async Task Search_GetSeries(string title, string year, CancellationToken cancellationToken) - { - // Reimplemented instead of calling Search_GetSeries_list() for efficiency - RootObject WebContent = await WebRequestAPI(SearchLink.Replace("{0}", title)); - foreach (MediaSearchResult media in WebContent.data.Page.media) - { - if (media.startDate.year == int.Parse(year)) - return media; - } - foreach (MediaSearchResult media in WebContent.data.Page.media) + foreach (MediaSearchResult media in medias) { return media; } diff --git a/Jellyfin.Plugin.AniList/Providers/AniList/AniListHelper.cs b/Jellyfin.Plugin.AniList/Providers/AniList/AniListHelper.cs index 5de0d6e..1cd9649 100644 --- a/Jellyfin.Plugin.AniList/Providers/AniList/AniListHelper.cs +++ b/Jellyfin.Plugin.AniList/Providers/AniList/AniListHelper.cs @@ -1,6 +1,6 @@ using System; using Microsoft.Extensions.Logging; -using MediaBrowser.Common.Configuration; +using Jellyfin.Plugin.AniList.Configuration; namespace Jellyfin.Plugin.AniList.Providers.AniList { diff --git a/Jellyfin.Plugin.AniList/Providers/AniList/AniListMovieProvider.cs b/Jellyfin.Plugin.AniList/Providers/AniList/AniListMovieProvider.cs index 30df4bd..2842e58 100644 --- a/Jellyfin.Plugin.AniList/Providers/AniList/AniListMovieProvider.cs +++ b/Jellyfin.Plugin.AniList/Providers/AniList/AniListMovieProvider.cs @@ -5,8 +5,6 @@ using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using System.Net.Http; -using System.Net.Http.Headers; using System.Text.Json; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Net; @@ -57,7 +55,7 @@ public async Task> GetMetadata(MovieInfo info, Cancellatio if (msr == null && info.OriginalTitle != null) { - searchName = AniListHelper.NameHelper(info.OriginalTitle, _log); + searchName = AniListHelper.NameHelper(info.OriginalTitle, config, _log); await AniListHelper.RequestLimiter.Tick().ConfigureAwait(false); await Task.Delay(Plugin.Instance.Configuration.AniDbRateLimit).ConfigureAwait(false); @@ -67,7 +65,7 @@ public async Task> GetMetadata(MovieInfo info, Cancellatio if(msr == null && !String.Equals(info.OriginalTitle, info.Name, StringComparison.Ordinal)) { - searchName = AniListHelper.NameHelper(info.Name, _log); + searchName = AniListHelper.NameHelper(info.Name, config, _log); await AniListHelper.RequestLimiter.Tick().ConfigureAwait(false); await Task.Delay(Plugin.Instance.Configuration.AniDbRateLimit).ConfigureAwait(false); @@ -78,7 +76,7 @@ public async Task> GetMetadata(MovieInfo info, Cancellatio if (msr == null) { // get name from path - searchName = AniListHelper.NameHelper(Path.GetFileName(info.Path), _log); + searchName = AniListHelper.NameHelper(Path.GetFileName(info.Path), config, _log); // get media with correct year var animeYear = new Jellyfin.Plugin.AniList.Anitomy.Anitomy(Path.GetFileName(info.Path)).ExtractAnimeYear(); if (animeYear != null) diff --git a/Jellyfin.Plugin.AniList/Providers/AniList/AniListSeriesProvider.cs b/Jellyfin.Plugin.AniList/Providers/AniList/AniListSeriesProvider.cs index 5e387c0..5ba8ff2 100644 --- a/Jellyfin.Plugin.AniList/Providers/AniList/AniListSeriesProvider.cs +++ b/Jellyfin.Plugin.AniList/Providers/AniList/AniListSeriesProvider.cs @@ -49,7 +49,7 @@ public async Task> GetMetadata(SeriesInfo info, Cancellat if (msr == null && info.OriginalTitle != null) { - searchName = AniListHelper.NameHelper(info.OriginalTitle, _log); + searchName = AniListHelper.NameHelper(info.OriginalTitle, config, _log); await AniListHelper.RequestLimiter.Tick().ConfigureAwait(false); await Task.Delay(Plugin.Instance.Configuration.AniDbRateLimit).ConfigureAwait(false); @@ -59,7 +59,7 @@ public async Task> GetMetadata(SeriesInfo info, Cancellat if (msr == null && !String.Equals(info.OriginalTitle, info.Name, StringComparison.Ordinal)) { - searchName = AniListHelper.NameHelper(info.Name, _log); + searchName = AniListHelper.NameHelper(info.Name, config, _log); await AniListHelper.RequestLimiter.Tick().ConfigureAwait(false); await Task.Delay(Plugin.Instance.Configuration.AniDbRateLimit).ConfigureAwait(false); @@ -69,7 +69,7 @@ public async Task> GetMetadata(SeriesInfo info, Cancellat if(msr==null){ // get name from path - searchName = AniListHelper.NameHelper(Path.GetFileName(info.Path), _log); + searchName = AniListHelper.NameHelper(Path.GetFileName(info.Path), config, _log); // get media with correct year var animeYear = new Jellyfin.Plugin.AniList.Anitomy.Anitomy(Path.GetFileName(info.Path)).ExtractAnimeYear(); if (animeYear != null) diff --git a/README.md b/README.md index 180c570..eccd21c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +- 限制请求速度 +- 改了下匹配策略 +

Jellyfin AniList Plugin

Part of the Jellyfin Project