Refactor GetTmdbEpisode method to improve parameter readability and logging
This commit is contained in:
@@ -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<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";
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user