Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chu-shen committed Oct 5, 2024
1 parent aabb773 commit 93037c2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 54 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
18 changes: 0 additions & 18 deletions .github/workflows/release.yaml

This file was deleted.

22 changes: 3 additions & 19 deletions Jellyfin.Plugin.AniList/Providers/AniList/AniListApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,13 @@ public async Task<MediaSearchResult> Search_GetSeries(string title, Cancellation
public async Task<MediaSearchResult> 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<MediaSearchResult> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.AniList/Providers/AniList/AniListHelper.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,7 +55,7 @@ public async Task<MetadataResult<Movie>> 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);
Expand All @@ -67,7 +65,7 @@ public async Task<MetadataResult<Movie>> 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);
Expand All @@ -78,7 +76,7 @@ public async Task<MetadataResult<Movie>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<MetadataResult<Series>> 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);
Expand All @@ -59,7 +59,7 @@ public async Task<MetadataResult<Series>> 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);
Expand All @@ -69,7 +69,7 @@ public async Task<MetadataResult<Series>> 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)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- 限制请求速度
- 改了下匹配策略

<h1 align="center">Jellyfin AniList Plugin</h1>
<h3 align="center">Part of the <a href="https://jellyfin.org">Jellyfin Project</a></h3>

Expand Down

0 comments on commit 93037c2

Please sign in to comment.