From 1112cd8f7cc42921d6f8077ba1785cd584f50ad0 Mon Sep 17 00:00:00 2001 From: LJQ Date: Sun, 27 Oct 2024 21:31:52 +0800 Subject: [PATCH] Fix is match logic --- Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs b/Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs index 0962baf..065d9c1 100644 --- a/Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs +++ b/Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs @@ -107,17 +107,17 @@ private static bool IsMatch(this string translation, string? language) return false; } - language = language?.ToLowerInvariant() switch + var mappedlanguage = language?.ToLowerInvariant() switch { "zh-tw" => "zhtw", // Unique case for zh-TW "pt-br" => "pt", // Unique case for pt-BR0 "pt-pt" => "por", // Unique case for pt-PT - _ => language, + _ => null, }; - if (translation.Equals(language, StringComparison.OrdinalIgnoreCase)) + if (mappedlanguage is not null) { - return true; + return translation.Equals(mappedlanguage, StringComparison.OrdinalIgnoreCase); } // try to find a match (ISO 639-2)