Skip to content

Commit

Permalink
Fixed: Latvian and Russian language parsing
Browse files Browse the repository at this point in the history
Improved support for Latvian with test cases I have encountered in the wild and fixed a case where Russian is not recognized (RU instead of RUS).
  • Loading branch information
AndrejsK authored and mynameisbogdan committed Jan 12, 2024
1 parent 58b726a commit a652ce5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs
Expand Up @@ -140,6 +140,8 @@ public void should_parse_language_chinese(string postTitle)
}

[TestCase("Movie.Title.1994.Russian.1080p.XviD-LOL")]
[TestCase("Movie.Title.2020.WEB-DLRip.AVC.AC3.EN.RU.ENSub.RUSub-LOL")]
[TestCase("Movie Title (2020) WEB-DL (720p) Rus-Eng")]
public void should_parse_language_russian(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle, true);
Expand Down Expand Up @@ -388,6 +390,8 @@ public void should_parse_language_slovak(string postTitle)
[TestCase("Movie.Title.2022.lv.WEBRip.XviD-LOL")]
[TestCase("Movie.Title.2022.LATVIAN.WEBRip.XviD-LOL")]
[TestCase("Movie.Title.2022.Latvian.WEBRip.XviD-LOL")]
[TestCase("Movie.Title.2022.1080p.WEB-DL.DDP5.1.Atmos.H.264.Lat.Eng")]
[TestCase("Movie.Title.2022.1080p.WEB-DL.LAV.RUS-NPPK")]
public void should_parse_language_latvian(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle);
Expand Down
4 changes: 2 additions & 2 deletions src/NzbDrone.Core/Parser/LanguageParser.cs
Expand Up @@ -22,15 +22,15 @@ public static class LanguageParser
(?<brazilian>dublado)|
(?<greek>greek)|
(?<french>\b(?:FR|VO|VF|VFF|VFQ|VFI|VF2|TRUEFRENCH|FRE|FRA)\b)|
(?<russian>\brus\b)|
(?<russian>\b(?:rus|ru)\b)|
(?<english>\beng\b)|
(?<hungarian>\b(?:HUNDUB|HUN)\b)|
(?<hebrew>\b(?:HebDub|HebDubbed)\b)|
(?<polish>\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|
(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)|
(?<ukrainian>(?:(?:\dx)?UKR))|
(?<spanish>\b(?:español|castellano)\b)|
(?<latvian>\bLV\b)|
(?<latvian>\b(?:lat|lav|lv)\b)|
(?<telugu>\btel\b)|
(?<vietnamese>\bVIE\b)",
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
Expand Down

0 comments on commit a652ce5

Please sign in to comment.