1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-08-18 16:29:41 +02:00

Treat subbed as unknown language (#5677)

* Subbed releases shouldn't report as different lang

* Add tests for subbed releases

* Remove whitespace
This commit is contained in:
tenshiak 2021-01-25 05:53:15 +01:00 committed by GitHub
parent ceeea9f7c6
commit 3bfb08c3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -173,6 +173,16 @@ public void should_parse_language_polish(string postTitle)
result.Languages.Should().BeEquivalentTo(Language.Polish);
}
[TestCase("Pulp.Fiction.1994.PL-SUB.1080p.XviD-LOL")]
[TestCase("Pulp.Fiction.1994.PLSUB.1080p.XviD-LOL")]
[TestCase("Pulp.Fiction.1994.SUB-PL.1080p.XviD-LOL")]
public void should_parse_language_polish_subbed(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle, true);
result.Languages.Should().BeEquivalentTo(Language.Unknown);
}
[TestCase("Pulp.Fiction.1994.Vietnamese.1080p.XviD-LOL")]
public void should_parse_language_vietnamese(string postTitle)
{

View File

@ -17,7 +17,7 @@ public static class LanguageParser
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?<italian>\b(?:ita|italian)\b)|(?<german>\b(?:german|videomann|ger)\b)|(?<flemish>flemish)|(?<bulgarian>bgaudio)|(?<brazilian>dublado)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VO|VFF|VFQ|VFI|VF2|TRUEFRENCH)(?:\W|_))|(?<russian>\brus\b)|(?<english>\beng\b)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)|(?<polish>\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?<lithuanian>\bLT\b)|(?<czech>\bCZ\b)|(?<polish>\bPL\b)",
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|(?<czech>\bCZ\b)|(?<polish>\bPL\b))(?:(?i)(?![\W|_|^]SUB))",
RegexOptions.Compiled);
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})(?:[-_. ]forced)?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);