From b008a54fdbb731db8c36e2585e224927237945b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=AF=9A?= Date: Wed, 19 Mar 2025 15:27:00 +0800 Subject: [PATCH] Refactor GetTmdbEpisode method to improve parameter readability and logging --- src/Service/Jobs/ChineseNfoRegistry.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Service/Jobs/ChineseNfoRegistry.cs b/src/Service/Jobs/ChineseNfoRegistry.cs index 74a6535..3706d5c 100644 --- a/src/Service/Jobs/ChineseNfoRegistry.cs +++ b/src/Service/Jobs/ChineseNfoRegistry.cs @@ -175,7 +175,11 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry continue; } - var json = await GetTmdbEpisode(tmdbId, season, episode); + var json = await GetTmdbEpisode( + episodeFile, + tmdbId, + season, + episode); if (json == null) { @@ -257,7 +261,11 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry await WxNotify.SendCommonAsync($"ChineseNfoRegistry.Job() success: {successCount}, failed: {failedCount}, skipped: {skippedCount}"); } - private async Task GetTmdbEpisode(int tmdbId, int season, int episode) + private async Task GetTmdbEpisode( + string path, + int tmdbId, + int season, + int episode) { const string episodeUrl = "/3/tv/{0}/season/{1}/episode/{2}?api_key=e28e1bc408db7adefc8bacce225c5085&language=zh-CN"; var requestUrl = string.Format(episodeUrl, tmdbId, season, episode); @@ -267,7 +275,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry var response = await _client.GetAsync(requestUrl); if (!response.IsSuccessStatusCode) { - Console.WriteLine($"{requestUrl} & {response.StatusCode}"); + Console.WriteLine($"{requestUrl} & {path} & {response.StatusCode}"); return null; } @@ -277,7 +285,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry } catch (Exception e) { - Console.WriteLine($"{requestUrl} \r {e}"); + Console.WriteLine($"{requestUrl} & {path} \r {e}"); return null; } }