From df8ca3cbd7583a64463d8eb441816c14c861b238 Mon Sep 17 00:00:00 2001 From: Meiam <91270@qq.com> Date: Mon, 22 Dec 2025 19:31:48 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=8C=E5=96=84=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E4=B8=8E=E5=8F=91=E5=B8=83=E6=96=87=E6=A1=A3=EF=BC=8C=E5=87=86?= =?UTF-8?q?=E5=A4=87=E5=8F=91=E5=B8=83=20v1.0.13.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + .../Emby.MeiamSub.Shooter.csproj | 6 +-- .../Emby.MeiamSub.Thunder.csproj | 6 +-- .../Jellyfin.MeiamSub.Shooter.csproj | 6 +-- Jellyfin.MeiamSub.Shooter/ShooterProvider.cs | 44 ++++++++++++----- Jellyfin.MeiamSub.Shooter/meta.json | 12 +++++ .../Jellyfin.MeiamSub.Thunder.csproj | 4 +- Jellyfin.MeiamSub.Thunder/ThunderProvider.cs | 48 +++++++++++++------ Jellyfin.MeiamSub.Thunder/meta.json | 12 +++++ 9 files changed, 104 insertions(+), 36 deletions(-) create mode 100644 Jellyfin.MeiamSub.Shooter/meta.json create mode 100644 Jellyfin.MeiamSub.Thunder/meta.json diff --git a/.gitignore b/.gitignore index a0ce143..2525036 100644 --- a/.gitignore +++ b/.gitignore @@ -366,3 +366,5 @@ FodyWeavers.xsd /TestServer TestServer/ +*.bat +*.md diff --git a/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj b/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj index 0b02117..0d56c2d 100644 --- a/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj +++ b/Emby.MeiamSub.Shooter/Emby.MeiamSub.Shooter.csproj @@ -1,9 +1,9 @@  - 1.0.12.0 - 1.0.12.0 - 1.0.12.0 + 1.0.13.0 + 1.0.13.0 + 1.0.13.0 diff --git a/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj b/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj index df6d284..6df758f 100644 --- a/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj +++ b/Emby.MeiamSub.Thunder/Emby.MeiamSub.Thunder.csproj @@ -1,9 +1,9 @@  - 1.0.12.0 - 1.0.12.0 - 1.0.12.0 + 1.0.13.0 + 1.0.13.0 + 1.0.13.0 diff --git a/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj b/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj index 3e819bc..adfaf0a 100644 --- a/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj +++ b/Jellyfin.MeiamSub.Shooter/Jellyfin.MeiamSub.Shooter.csproj @@ -2,9 +2,9 @@ net9.0 - 1.0.12.0 - 1.0.12.0 - 1.0.12.0 + 1.0.13.0 + 1.0.13.0 + 1.0.13.0 diff --git a/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs b/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs index 8cf44c3..25f64ff 100644 --- a/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs +++ b/Jellyfin.MeiamSub.Shooter/ShooterProvider.cs @@ -71,7 +71,7 @@ namespace Jellyfin.MeiamSub.Shooter /// 远程字幕信息列表 public async Task> Search(SubtitleSearchRequest request, CancellationToken cancellationToken) { - _logger.LogInformation($"{Name} Search | SubtitleSearchRequest -> {JsonSerializer.Serialize(request)}"); + _logger.LogInformation("DEBUG: Received Search request for " + (request?.MediaPath ?? "NULL")); var subtitles = await SearchSubtitlesAsync(request); @@ -87,27 +87,49 @@ namespace Jellyfin.MeiamSub.Shooter { // 修改人: Meiam // 修改时间: 2025-12-22 - // 备注: 增加异常处理 + // 备注: 增加极致探测日志,定位方法中断的具体位置 + + _logger.LogInformation("DEBUG: Entering SearchSubtitlesAsync"); try { - var language = NormalizeLanguage(request.Language); - - _logger.LogInformation("{Provider} Search | Target -> {File} | Language -> {Lang}", Name, Path.GetFileName(request.MediaPath), language); - - if (language != "chi" && language != "eng") + if (request == null) { - _logger.LogInformation("{Provider} Search | Summary -> Language not supported, skip search.", Name); + _logger.LogInformation("DEBUG: Request is null"); return Array.Empty(); } - FileInfo fileInfo = new(request.MediaPath); + var language = NormalizeLanguage(request.Language); + var fileName = string.Empty; + + if (!string.IsNullOrEmpty(request.MediaPath)) + { + fileName = Path.GetFileName(request.MediaPath); + } + + _logger.LogInformation(Name + " Search | Target -> " + fileName + " | Language -> " + language); + + if (language != "chi" && language != "eng") + { + _logger.LogInformation(Name + " Search | Summary -> Language not supported, skip search."); + return Array.Empty(); + } + + if (string.IsNullOrEmpty(request.MediaPath)) + { + _logger.LogInformation(Name + " Search | Summary -> MediaPath is empty, skip search."); + return Array.Empty(); + } + + FileInfo fileInfo = new FileInfo(request.MediaPath); + + _logger.LogInformation("DEBUG: Starting hash calculation for " + fileName); var stopWatch = Stopwatch.StartNew(); var hash = await ComputeFileHashAsync(fileInfo); stopWatch.Stop(); - _logger.LogInformation("{Provider} Search | FileHash -> {Hash} (Took {Elapsed}ms)", Name, hash, stopWatch.ElapsedMilliseconds); + _logger.LogInformation(Name + " Search | FileHash -> " + hash + " (Took " + stopWatch.ElapsedMilliseconds + "ms)"); var formData = new Dictionary { @@ -208,7 +230,7 @@ namespace Jellyfin.MeiamSub.Shooter } catch (Exception ex) { - _logger.LogError(ex, "{Provider} Search | Exception -> [{Type}] {Message}", Name, ex.GetType().Name, ex.Message); + _logger.LogError(ex, $"{Name} Search | Exception -> {ex.Message}"); } _logger.LogInformation($"{Name} Search | Summary -> Get 0 Subtitles"); diff --git a/Jellyfin.MeiamSub.Shooter/meta.json b/Jellyfin.MeiamSub.Shooter/meta.json new file mode 100644 index 0000000..8e7698e --- /dev/null +++ b/Jellyfin.MeiamSub.Shooter/meta.json @@ -0,0 +1,12 @@ +{ + "category": "Subtitles", + "description": "Download subtitles from Shooter", + "guid": "038D37A2-7A1E-4C01-9B6D-AA215D29AB4C", + "name": "MeiamSub.Shooter", + "owner": "Meiam", + "targetAbi": "10.11.0.0", + "timestamp": "2025-12-22T10:00:00.0000000Z", + "version": "1.0.13.0", + "status": "Active", + "imagePath": "thumb.png" +} diff --git a/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj b/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj index 53f4022..689180e 100644 --- a/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj +++ b/Jellyfin.MeiamSub.Thunder/Jellyfin.MeiamSub.Thunder.csproj @@ -3,8 +3,8 @@ Library net9.0 - 1.0.12.0 - 1.0.12.0 + 1.0.13.0 + 1.0.13.0 diff --git a/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs b/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs index b6b079c..26a2611 100644 --- a/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs +++ b/Jellyfin.MeiamSub.Thunder/ThunderProvider.cs @@ -66,14 +66,14 @@ namespace Jellyfin.MeiamSub.Thunder /// 包含媒体路径、语言等信息的搜索请求对象 /// 取消令牌 /// 远程字幕信息列表 - public async Task> Search(SubtitleSearchRequest request, CancellationToken cancellationToken) - { - _logger.LogInformation($"{Name} Search | SubtitleSearchRequest -> {JsonSerializer.Serialize(request)}"); - - var subtitles = await SearchSubtitlesAsync(request); - - return subtitles; - } + public async Task> Search(SubtitleSearchRequest request, CancellationToken cancellationToken) + { + _logger.LogInformation("DEBUG: Received Search request for " + (request?.MediaPath ?? "NULL")); + + var subtitles = await SearchSubtitlesAsync(request); + + return subtitles; + } /// /// 查询字幕 @@ -84,17 +84,37 @@ namespace Jellyfin.MeiamSub.Thunder { // 修改人: Meiam // 修改时间: 2025-12-22 - // 备注: 增加异常处理 + // 备注: 增加极致探测日志 + + _logger.LogInformation("DEBUG: Entering SearchSubtitlesAsync (Thunder)"); try { - var language = NormalizeLanguage(request.Language); + if (request == null) + { + _logger.LogInformation("DEBUG: Request is null"); + return Array.Empty(); + } - _logger.LogInformation("{Provider} Search | Target -> {File} | Language -> {Lang}", Name, Path.GetFileName(request.MediaPath), language); + var language = NormalizeLanguage(request.Language); + var fileName = string.Empty; + + if (!string.IsNullOrEmpty(request.MediaPath)) + { + fileName = Path.GetFileName(request.MediaPath); + } + + _logger.LogInformation(Name + " Search | Target -> " + fileName + " | Language -> " + language); if (language != "chi") { - _logger.LogInformation("{Provider} Search | Summary -> Language not supported, skip search.", Name); + _logger.LogInformation(Name + " Search | Summary -> Language not supported, skip search."); + return Array.Empty(); + } + + if (string.IsNullOrEmpty(request.MediaPath)) + { + _logger.LogInformation(Name + " Search | Summary -> MediaPath is empty, skip search."); return Array.Empty(); } @@ -102,7 +122,7 @@ namespace Jellyfin.MeiamSub.Thunder var cid = await GetCidByFileAsync(request.MediaPath); stopWatch.Stop(); - _logger.LogInformation("{Provider} Search | FileHash -> {Hash} (Took {Elapsed}ms)", Name, cid, stopWatch.ElapsedMilliseconds); + _logger.LogInformation(Name + " Search | FileHash -> " + cid + " (Took " + stopWatch.ElapsedMilliseconds + "ms)"); using var options = new HttpRequestMessage { @@ -159,7 +179,7 @@ namespace Jellyfin.MeiamSub.Thunder } catch (Exception ex) { - _logger.LogError(ex, "{Provider} Search | Exception -> [{Type}] {Message}", Name, ex.GetType().Name, ex.Message); + _logger.LogError(ex, $"{Name} Search | Exception -> {ex.Message}"); } _logger.LogInformation($"{Name} Search | Summary -> Get 0 Subtitles"); diff --git a/Jellyfin.MeiamSub.Thunder/meta.json b/Jellyfin.MeiamSub.Thunder/meta.json new file mode 100644 index 0000000..ee0d575 --- /dev/null +++ b/Jellyfin.MeiamSub.Thunder/meta.json @@ -0,0 +1,12 @@ +{ + "category": "Subtitles", + "description": "Download subtitles from Thunder XMP", + "guid": "E4CE9DA9-EF00-417C-96F2-861C512D45EB", + "name": "MeiamSub.Thunder", + "owner": "Meiam", + "targetAbi": "10.11.0.0", + "timestamp": "2025-12-22T10:00:00.0000000Z", + "version": "1.0.13.0", + "status": "Active", + "imagePath": "thumb.png" +}