From 65e1f9586e74b9567d585cfe955d0bb2eb62bfd2 Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Mon, 20 Feb 2023 19:47:33 +0800 Subject: [PATCH] Fix ignore change season name --- .../LibraryManagerEventsHelper.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Jellyfin.Plugin.Danmu/LibraryManagerEventsHelper.cs b/Jellyfin.Plugin.Danmu/LibraryManagerEventsHelper.cs index 535e074..ed391a6 100644 --- a/Jellyfin.Plugin.Danmu/LibraryManagerEventsHelper.cs +++ b/Jellyfin.Plugin.Danmu/LibraryManagerEventsHelper.cs @@ -484,17 +484,21 @@ public class LibraryManagerEventsHelper : IDisposable { try { - // 读取最新数据,要不然取不到年份信息 - var currentItem = _libraryManager.GetItemById(season.Id) ?? season; + // 读取最新数据,要不然取不到年份信息(不能对GetItemById的对象直接修改属性,要不然会直接改到数据!!!!) + var currentItem = _libraryManager.GetItemById(season.Id); + if (currentItem != null) + { + season.ProductionYear = currentItem.ProductionYear; + } // 季的名称不准确,改使用series的名称 if (series != null) { - currentItem.Name = series.Name; + season.Name = series.Name; } - var mediaId = await scraper.SearchMediaId(currentItem); + var mediaId = await scraper.SearchMediaId(season); if (string.IsNullOrEmpty(mediaId)) { - _logger.LogInformation("[{0}]匹配失败:{1} ({2})", scraper.Name, currentItem.Name, currentItem.ProductionYear); + _logger.LogInformation("[{0}]匹配失败:{1} ({2})", scraper.Name, season.Name, season.ProductionYear); continue; } @@ -599,7 +603,7 @@ public class LibraryManagerEventsHelper : IDisposable } else { - _logger.LogInformation("[{0}]刷新弹幕失败, 集数不一致。video: {1} 弹幕数:{2} 集数:{3}", scraper.Name, season.Name, media.Episodes.Count, episodes.Count); + _logger.LogInformation("[{0}]刷新弹幕失败, 集数不一致。video: {1}.{2} 弹幕数:{3} 集数:{4}", scraper.Name, indexNumber, episode.Name, media.Episodes.Count, episodes.Count); } }