From 9c0448898a97fb50bc4510162bdf9ee7135ad228 Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Sat, 6 Jan 2024 10:16:59 +0800 Subject: [PATCH] tweak: optimize log output --- Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs | 9 ++++++++- Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs | 3 ++- Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs | 4 +++- Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs b/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs index b8ce6d7..5411c92 100644 --- a/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs +++ b/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs @@ -169,13 +169,20 @@ public void TestEposideParse() Assert.AreEqual(parseResult.Name, "New World"); Assert.AreEqual(parseResult.Year, 2013); - // 只英文 + // 只英文S01E01 fileName = "She-Hulk.Attorney.At.Law.S01E01.1080p.WEBRip.x265-RARBG"; parseResult = NameParser.Parse(fileName); Assert.AreEqual(parseResult.Name, "She-Hulk Attorney At Law"); Assert.AreEqual(parseResult.ParentIndexNumber, 1); Assert.AreEqual(parseResult.IndexNumber, 1); + // 只英文S01EP01 + fileName = "Detective.Dee.S01EP18.2004.1080p.WEB-DL.x264.AAC-HQCS"; + parseResult = NameParser.Parse(fileName); + Assert.AreEqual(parseResult.Name, "Detective Dee"); + Assert.AreEqual(parseResult.ParentIndexNumber, 1); + Assert.AreEqual(parseResult.IndexNumber, 18); + // 日文 fileName = "プロポーズ大作戦Ep05_x264.mp4"; diff --git a/Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs b/Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs index 8aabedf..183bb32 100644 --- a/Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs +++ b/Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs @@ -79,7 +79,8 @@ public async Task> GetSearchResults(MovieInfo in /// public async Task> GetMetadata(MovieInfo info, CancellationToken cancellationToken) { - this.Log($"GetMovieMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}"); + var fileName = this.GetOriginalFileName(info); + this.Log($"GetMovieMetadata of [name]: {info.Name} [fileName]: {fileName} IsAutomated: {info.IsAutomated}"); var result = new MetadataResult(); // 使用刷新元数据时,providerIds会保留旧有值,只有识别/新增才会没值 diff --git a/Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs b/Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs index 74e3528..9dbf6b5 100644 --- a/Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs +++ b/Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs @@ -40,12 +40,14 @@ public async Task> GetMetadata(SeasonInfo info, Cancellat { var result = new MetadataResult(); + // 使用刷新元数据时,之前识别的seasonNumber会保留,不会被覆盖 info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out var seriesTmdbId); info.SeriesProviderIds.TryGetValue(Plugin.ProviderId, out var metaSource); info.SeriesProviderIds.TryGetValue(DoubanProviderId, out var sid); var seasonNumber = info.IndexNumber; // S00/Season 00特典目录会为0 var seasonSid = info.GetProviderId(DoubanProviderId); - this.Log($"GetSeasonMetaData of [name]: {info.Name} number: {info.IndexNumber} seriesTmdbId: {seriesTmdbId} sid: {sid} metaSource: {metaSource} IsAutomated: {info.IsAutomated}"); + var fileName = this.GetOriginalFileName(info); + this.Log($"GetSeasonMetaData of [name]: {info.Name} [fileName]: {fileName} number: {info.IndexNumber} seriesTmdbId: {seriesTmdbId} sid: {sid} metaSource: {metaSource} IsAutomated: {info.IsAutomated}"); if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid)) { diff --git a/Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs b/Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs index 847fde1..f9185bc 100644 --- a/Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs +++ b/Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs @@ -76,7 +76,8 @@ public async Task> GetSearchResults(SeriesInfo i /// public async Task> GetMetadata(SeriesInfo info, CancellationToken cancellationToken) { - this.Log($"GetSeriesMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}"); + var fileName = this.GetOriginalFileName(info); + this.Log($"GetSeriesMetadata of [name]: {info.Name} [fileName]: {fileName} IsAutomated: {info.IsAutomated}"); var result = new MetadataResult(); var sid = info.GetProviderId(DoubanProviderId);