Refactor ChineseNfoRegistry for improved readability and consistency
This commit is contained in:
@@ -24,7 +24,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
|
|||||||
|
|
||||||
var proxyAddress = _configuration["ChineseNfo:HttpProxy"];
|
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.Proxy = string.IsNullOrEmpty(proxyAddress) ? null : new WebProxy(proxyAddress, false);
|
||||||
httpClientHandler.UseProxy = !string.IsNullOrEmpty(proxyAddress);
|
httpClientHandler.UseProxy = !string.IsNullOrEmpty(proxyAddress);
|
||||||
@@ -249,11 +249,11 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
|
|||||||
|
|
||||||
private async Task<JsonObject?> GetTmdbEpisode(int tmdbId, int season, int episode)
|
private async Task<JsonObject?> 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
|
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);
|
var response = await _client.GetAsync(requestUrl);
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -267,7 +267,7 @@ public class ChineseNfoRegistry : Registry, IChineseNfoRegistry
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{tmdbId} & {season} & {episode} & {e}");
|
Console.WriteLine($"{requestUrl} \r {e}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user