Refactor GetTmdbEpisode method to improve parameter readability and logging
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 23s
Docker Build & Deploy / Deploy to Production (push) Successful in 4s

This commit is contained in:
孙诚
2025-03-19 15:27:00 +08:00
parent 30813961ad
commit b008a54fdb

View File

@@ -175,7 +175,11 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
continue; continue;
} }
var json = await GetTmdbEpisode(tmdbId, season, episode); var json = await GetTmdbEpisode(
episodeFile,
tmdbId,
season,
episode);
if (json == null) if (json == null)
{ {
@@ -257,7 +261,11 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
await WxNotify.SendCommonAsync($"ChineseNfoRegistry.Job() success: {successCount}, failed: {failedCount}, skipped: {skippedCount}"); await WxNotify.SendCommonAsync($"ChineseNfoRegistry.Job() success: {successCount}, failed: {failedCount}, skipped: {skippedCount}");
} }
private async Task<JsonObject?> GetTmdbEpisode(int tmdbId, int season, int episode) private async Task<JsonObject?> 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"; const string episodeUrl = "/3/tv/{0}/season/{1}/episode/{2}?api_key=e28e1bc408db7adefc8bacce225c5085&language=zh-CN";
var requestUrl = string.Format(episodeUrl, tmdbId, season, episode); var requestUrl = string.Format(episodeUrl, tmdbId, season, episode);
@@ -267,7 +275,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
var response = await _client.GetAsync(requestUrl); var response = await _client.GetAsync(requestUrl);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
Console.WriteLine($"{requestUrl} & {response.StatusCode}"); Console.WriteLine($"{requestUrl} & {path} & {response.StatusCode}");
return null; return null;
} }
@@ -277,7 +285,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine($"{requestUrl} \r {e}"); Console.WriteLine($"{requestUrl} & {path} \r {e}");
return null; return null;
} }
} }