diff --git a/src/Service/Jobs/ChineseNfoRegistry.cs b/src/Service/Jobs/ChineseNfoRegistry.cs index 0b5b3ca..675c5fa 100644 --- a/src/Service/Jobs/ChineseNfoRegistry.cs +++ b/src/Service/Jobs/ChineseNfoRegistry.cs @@ -19,12 +19,12 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry { _configuration = configuration; _logger = logger; - + var httpClientHandler = new HttpClientHandler(); - + var proxyAddress = _configuration["ChineseNfo:HttpProxy"]; - - if(string.IsNullOrEmpty(proxyAddress) == false) + + if (string.IsNullOrEmpty(proxyAddress) == false) { httpClientHandler.Proxy = string.IsNullOrEmpty(proxyAddress) ? null : new WebProxy(proxyAddress, false); httpClientHandler.UseProxy = !string.IsNullOrEmpty(proxyAddress); @@ -32,7 +32,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry _client = new HttpClient(httpClientHandler); _client.BaseAddress = new Uri("https://api.themoviedb.org"); - + Schedule(() => Job(true, true)).ToRunEvery(1).Days(); } @@ -62,7 +62,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry var successCount = 0; var failedCount = 0; var skippedCount = 0; - + // 扫描 tvshow.nfo 文件 var tvShowFiles = Directory.GetFiles(tvFolder, "tvshow.nfo", SearchOption.AllDirectories); @@ -209,7 +209,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry } successCount++; - + // 添加一个已完成节点 if (completedNode == null) { @@ -243,17 +243,17 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry await Task.Delay(10000); } } - + await WxNotify.SendCommonAsync($"ChineseNfoRegistry.Job() success: {successCount}, failed: {failedCount}, skipped: {skippedCount}"); } private async Task GetTmdbEpisode(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); + try { - 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 response = await _client.GetAsync(requestUrl); if (!response.IsSuccessStatusCode) { @@ -267,7 +267,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry } catch (Exception e) { - Console.WriteLine($"{tmdbId} & {season} & {episode} & {e}"); + Console.WriteLine($"{requestUrl} \r {e}"); return null; } }