1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

New: Add Malayalam and Kannada languages

This commit is contained in:
Bogdan 2024-08-29 09:02:36 +03:00
parent 2d4846e5be
commit 453f216e0d
6 changed files with 44 additions and 3 deletions

View File

@ -59,7 +59,9 @@ public class LanguageFixture : CoreTest
new object[] { 44, Language.Indonesian },
new object[] { 45, Language.Telugu },
new object[] { 46, Language.Macedonian },
new object[] { 47, Language.Slovenian }
new object[] { 47, Language.Slovenian },
new object[] { 48, Language.Malayalam },
new object[] { 49, Language.Kannada }
};
public static object[] ToIntCases =
@ -113,7 +115,9 @@ public class LanguageFixture : CoreTest
new object[] { Language.Indonesian, 44 },
new object[] { Language.Telugu, 45 },
new object[] { Language.Macedonian, 46 },
new object[] { Language.Slovenian, 47 }
new object[] { Language.Slovenian, 47 },
new object[] { Language.Malayalam, 48 },
new object[] { Language.Kannada, 49 }
};
[Test]

View File

@ -419,6 +419,23 @@ public void should_parse_language_catalan(string postTitle)
result.Languages.Should().Contain(Language.Catalan);
}
[TestCase("Movie Title (2024) Malayalam BRRip 1080p x264 DTS 5.1 E-subs-MBRHDRG")]
[TestCase("Movie.Title.2024.Malayalam.1080p.AMZN.WEB-DL.DD+5.1.H.264-Shadow.BonsaiHD")]
[TestCase("Movie.Title.2024.2160p.Malayalam.WEB-DL.H.265.SDR.DDP5.1-NbT")]
public void should_parse_language_malayalam(string postTitle)
{
var result = LanguageParser.ParseLanguages(postTitle);
result.Should().Contain(Language.Malayalam);
}
[TestCase("Movie Title (2024) Kannada 1080p HD AVC MP4 x264 .9.8GB TEAMTR")]
[TestCase("Movie.Title.2024.Kannada.1080p.AMZN.WEB-DL.DD+2.0.x264-Telly")]
public void should_parse_language_kannada(string postTitle)
{
var result = LanguageParser.ParseLanguages(postTitle);
result.Should().Contain(Language.Kannada);
}
[TestCase("Movie.Title.en.sub")]
[TestCase("Movie Title.eng.sub")]
[TestCase("Movie.Title.eng.forced.sub")]

View File

@ -57,6 +57,10 @@ public enum TMDbLanguageCodes
[FieldOption(Hint = "Macedonian")]
mk,
[FieldOption(Hint = "Slovenian")]
sl
sl,
[FieldOption(Hint = "Malayalam")]
ml,
[FieldOption(Hint = "Kannada")]
kn
}
}

View File

@ -118,6 +118,8 @@ public override bool Equals(object obj)
public static Language Telugu => new Language(45, "Telugu");
public static Language Macedonian => new Language(46, "Macedonian");
public static Language Slovenian => new Language(47, "Slovenian");
public static Language Malayalam => new Language(48, "Malayalam");
public static Language Kannada => new Language(49, "Kannada");
public static Language Any => new Language(-1, "Any");
public static Language Original => new Language(-2, "Original");
@ -175,6 +177,8 @@ public static List<Language> All
Telugu,
Macedonian,
Slovenian,
Malayalam,
Kannada,
Any,
Original
};

View File

@ -57,6 +57,8 @@ public static class IsoLanguages
new IsoLanguage("te", "", "tel", "Telugu", Language.Telugu),
new IsoLanguage("mk", "", "mkd", "Macedonian", Language.Macedonian),
new IsoLanguage("sl", "", "slv", "Slovenian", Language.Slovenian),
new IsoLanguage("ml", "", "mal", "Malayalam", Language.Malayalam),
new IsoLanguage("kn", "", "kan", "Kannada", Language.Kannada),
};
private static readonly Dictionary<string, Language> AlternateIsoCodeMappings = new ()

View File

@ -217,6 +217,16 @@ public static List<Language> ParseLanguages(string title)
languages.Add(Language.Telugu);
}
if (lowerTitle.Contains("malayalam"))
{
languages.Add(Language.Malayalam);
}
if (lowerTitle.Contains("kannada"))
{
languages.Add(Language.Kannada);
}
// Case sensitive
var caseSensitiveMatches = CaseSensitiveLanguageRegex.Matches(title);