mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
Fixed: Refresh movie failing.
This commit is contained in:
parent
ba531fff4d
commit
fc805e5078
2 changed files with 16 additions and 5 deletions
|
@ -1,9 +1,13 @@
|
|||
namespace NzbDrone.Core.Parser
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Parser
|
||||
{
|
||||
public class IsoLanguage
|
||||
{
|
||||
public string TwoLetterCode { get; set; }
|
||||
public string ThreeLetterCode { get; set; }
|
||||
public List<string> AltCodes = new List<string>();
|
||||
public Language Language { get; set; }
|
||||
|
||||
public IsoLanguage(string twoLetterCode, string threeLetterCode, Language language)
|
||||
|
@ -13,5 +17,14 @@ public IsoLanguage(string twoLetterCode, string threeLetterCode, Language langua
|
|||
Language = language;
|
||||
}
|
||||
|
||||
public IsoLanguage(List<string> twoLetterCodes, string threeLetterCode, Language language)
|
||||
{
|
||||
TwoLetterCode = twoLetterCodes.First();
|
||||
twoLetterCodes.RemoveAt(0);
|
||||
ThreeLetterCode = threeLetterCode;
|
||||
Language = language;
|
||||
AltCodes.AddRange(twoLetterCodes);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@ public static class IsoLanguages
|
|||
{
|
||||
private static readonly HashSet<IsoLanguage> All = new HashSet<IsoLanguage>
|
||||
{
|
||||
new IsoLanguage("en", "eng", Language.English),
|
||||
new IsoLanguage("us", "usa", Language.English), //For tmdb mapping
|
||||
new IsoLanguage("uk", "brit", Language.English), //For tmdb mapping too.
|
||||
new IsoLanguage(new List<string> {"en", "us", "uk"}, "eng", Language.English),
|
||||
new IsoLanguage("fr", "fra", Language.French),
|
||||
new IsoLanguage("es", "spa", Language.Spanish),
|
||||
new IsoLanguage("de", "deu", Language.German),
|
||||
|
@ -39,7 +37,7 @@ public static IsoLanguage Find(string isoCode)
|
|||
if (isoCode.Length == 2)
|
||||
{
|
||||
//Lookup ISO639-1 code
|
||||
return All.SingleOrDefault(l => l.TwoLetterCode == isoCode);
|
||||
return All.SingleOrDefault(l => l.TwoLetterCode == isoCode) ?? All.SingleOrDefault(l => l.AltCodes.Contains(isoCode));
|
||||
}
|
||||
else if (isoCode.Length == 3)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue