Skip to content

Commit

Permalink
Updates to new language function
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed Oct 13, 2018
1 parent ce00b21 commit 4441c54
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions TVRename/TheTVDB/TheTVDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ private void ProcessUpdate(JObject jsonResponse, string uri)
List<JObject> episodeDefaultLangResponses = null;
string requestedLanguageCode = series[id].useCustomLanguage ? series[id].targetLanguageCode: TVSettings.Instance.PreferredLanguageCode;
List<JObject> episodeResponses = GetEpisodes(id, requestedLanguageCode);
if (IsnNotDefaultLanguage(requestedLanguageCode)) episodeDefaultLangResponses = GetEpisodes(id, DefaultLanguageCode);
if (IsNotDefaultLanguage(requestedLanguageCode)) episodeDefaultLangResponses = GetEpisodes(id, DefaultLanguageCode);

Dictionary<int, Tuple<JToken, JToken>> episodesResponses =
MergeEpisodeResponses(episodeResponses, episodeDefaultLangResponses);
Expand Down Expand Up @@ -1234,7 +1234,7 @@ private SeriesInfo DownloadSeriesNow(int code, bool episodesToo, bool bannersToo
{
jsonResponse = HttpHelper.JsonHttpGetRequest(uri, null, tvDbTokenProvider.GetToken(),requestedLanguageCode);

if (IsnNotDefaultLanguage(requestedLanguageCode))
if (IsNotDefaultLanguage(requestedLanguageCode))
jsonDefaultLangResponse =
HttpHelper.JsonHttpGetRequest(uri, null, tvDbTokenProvider.GetToken(), DefaultLanguageCode);
}
Expand All @@ -1250,7 +1250,7 @@ private SeriesInfo DownloadSeriesNow(int code, bool episodesToo, bool bannersToo
SeriesInfo si;
JObject seriesData = (JObject) jsonResponse["data"];

if (InForeignLanguage())
if (IsNotDefaultLanguage(requestedLanguageCode))
{
JObject seriesDataDefaultLang = (JObject) jsonDefaultLangResponse["data"];
si = new SeriesInfo(seriesData, seriesDataDefaultLang, GetLanguageId());
Expand Down Expand Up @@ -1322,7 +1322,7 @@ private SeriesInfo DownloadSeriesNow(int code, bool episodesToo, bool bannersToo
}
}

if (IsnNotDefaultLanguage(requestedLanguageCode))
if (IsNotDefaultLanguage(requestedLanguageCode))
{
List<string> imageDefaultLangTypes = new List<string>();

Expand Down Expand Up @@ -1460,7 +1460,7 @@ private void ReloadEpisodes(int code, bool useCustomLangCode, string langCode)
string requestLangCode = useCustomLangCode ? langCode : TVSettings.Instance.PreferredLanguageCode;
List<JObject> episodePrefLangResponses = GetEpisodes(code, requestLangCode);
List<JObject> episodeDefaultLangResponses = null;
if (IsnNotDefaultLanguage(requestLangCode)) episodeDefaultLangResponses = GetEpisodes(code, DefaultLanguageCode);
if (IsNotDefaultLanguage(requestLangCode)) episodeDefaultLangResponses = GetEpisodes(code, DefaultLanguageCode);

Dictionary<int, Tuple<JToken, JToken>> episodeResponses = MergeEpisodeResponses(episodePrefLangResponses, episodeDefaultLangResponses);

Expand Down Expand Up @@ -1540,7 +1540,7 @@ private static Dictionary<int, Tuple<JToken, JToken>> MergeEpisodeResponses(List

private bool InForeignLanguage() => DefaultLanguageCode != TVSettings.Instance.PreferredLanguageCode;

private bool IsnNotDefaultLanguage(string languageCode) => DefaultLanguageCode != languageCode;
private bool IsNotDefaultLanguage(string languageCode) => DefaultLanguageCode != languageCode;

private bool DownloadEpisodeNow(int seriesId, int episodeId, bool dvdOrder = false)
{
Expand All @@ -1563,7 +1563,7 @@ private bool DownloadEpisodeNow(int seriesId, int episodeId, bool dvdOrder = fal
{
jsonEpisodeResponse = HttpHelper.JsonHttpGetRequest(uri, null, tvDbTokenProvider.GetToken(), requestLangCode);

if (IsnNotDefaultLanguage(requestLangCode))
if (IsNotDefaultLanguage(requestLangCode))
jsonEpisodeDefaultLangResponse =
HttpHelper.JsonHttpGetRequest(uri, null, tvDbTokenProvider.GetToken(), DefaultLanguageCode);
}
Expand All @@ -1583,7 +1583,7 @@ private bool DownloadEpisodeNow(int seriesId, int episodeId, bool dvdOrder = fal
Episode e;
JObject jsonResponseData = (JObject)jsonEpisodeResponse["data"];

if (IsnNotDefaultLanguage(requestLangCode))
if (IsNotDefaultLanguage(requestLangCode))
{
JObject seriesDataDefaultLang = (JObject) jsonEpisodeDefaultLangResponse["data"];
e = new Episode(seriesId, jsonResponseData, seriesDataDefaultLang);
Expand Down

0 comments on commit 4441c54

Please sign in to comment.