From 94894d29fac677c7f3e272b63043c0da98f74d0b Mon Sep 17 00:00:00 2001 From: kookxiang Date: Sun, 21 Jul 2024 19:30:02 +0800 Subject: [PATCH] add infobox support; add translation setting for person #143 --- Jellyfin.Plugin.Bangumi.Test/Person.cs | 7 +++-- Jellyfin.Plugin.Bangumi.Test/Series.cs | 1 + .../Configuration/ConfigPage.html | 7 +++++ .../Configuration/PluginConfiguration.cs | 2 ++ Jellyfin.Plugin.Bangumi/Model/InfoBox.cs | 23 +++++++++++++++ Jellyfin.Plugin.Bangumi/Model/PersonDetail.cs | 28 +++++++++++++++++++ Jellyfin.Plugin.Bangumi/Model/Subject.cs | 23 +++++++++++++-- .../Providers/MovieProvider.cs | 2 ++ .../Providers/PersonProvider.cs | 7 +++-- .../Providers/SeasonProvider.cs | 3 ++ .../Providers/SeriesProvider.cs | 4 ++- 11 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 Jellyfin.Plugin.Bangumi/Model/InfoBox.cs diff --git a/Jellyfin.Plugin.Bangumi.Test/Person.cs b/Jellyfin.Plugin.Bangumi.Test/Person.cs index cc8d1cb..1d5ad50 100644 --- a/Jellyfin.Plugin.Bangumi.Test/Person.cs +++ b/Jellyfin.Plugin.Bangumi.Test/Person.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Jellyfin.Plugin.Bangumi.Configuration; using Jellyfin.Plugin.Bangumi.Providers; using Jellyfin.Plugin.Bangumi.Test.Util; using MediaBrowser.Controller.Providers; @@ -28,12 +29,14 @@ public void ProviderInfo() [TestMethod] public async Task GetById() { + Bangumi.Plugin.Instance!.Configuration.PersonTranslationPreference = TranslationPreferenceType.Chinese; var result = await _provider.GetMetadata(new PersonLookupInfo { - ProviderIds = new Dictionary { { Constants.ProviderName, "5847" } } + ProviderIds = new Dictionary { { Constants.ProviderName, "7307" } } }, _token); Assert.IsNotNull(result.Item, "person info should not be null"); - Assert.AreEqual("茅野愛衣", result.Item.Name, "should return correct name"); + Assert.AreEqual("上坂すみれ", result.Item.OriginalTitle, "should return correct name"); + Assert.AreEqual("上坂堇", result.Item.Name, "should return translated name"); Assert.IsNotNull(result.Item.ProviderIds[Constants.ProviderName], "should have plugin provider id"); } diff --git a/Jellyfin.Plugin.Bangumi.Test/Series.cs b/Jellyfin.Plugin.Bangumi.Test/Series.cs index 86f0563..04c089c 100644 --- a/Jellyfin.Plugin.Bangumi.Test/Series.cs +++ b/Jellyfin.Plugin.Bangumi.Test/Series.cs @@ -192,6 +192,7 @@ private static void AssertSeries(MetadataResult 0 and <= 10, "should return rating info"); + Assert.IsNotNull(result.Item.HomePageUrl, "should return official website link"); Assert.IsNotNull(result.People.Find(x => x.IsType(PersonKind.Actor)), "should have at least one actor"); Assert.IsNotNull(result.People.Find(x => x.IsType(PersonKind.Director)), "should have at least one director"); Assert.IsNotNull(result.People.Find(x => x.IsType(PersonKind.Writer)), "should have at least one writer"); diff --git a/Jellyfin.Plugin.Bangumi/Configuration/ConfigPage.html b/Jellyfin.Plugin.Bangumi/Configuration/ConfigPage.html index ce98b75..2099a27 100644 --- a/Jellyfin.Plugin.Bangumi/Configuration/ConfigPage.html +++ b/Jellyfin.Plugin.Bangumi/Configuration/ConfigPage.html @@ -195,6 +195,13 @@

元数据

+
+ + +