mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
commit
7cf400975e
@ -43,6 +43,9 @@ public class LanguageParserFixture : CoreTest
|
||||
[TestCase("Constantine.2014.S01E01.WEBRiP.H264.AAC.5.1-NL.SUBS", Language.Dutch)]
|
||||
[TestCase("Elementary - S02E16 - Kampfhaehne - mkv - by Videomann", Language.German)]
|
||||
[TestCase("Two.Greedy.Italians.S01E01.The.Family.720p.HDTV.x264-FTP", Language.English)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUNDUB-LOL", Language.Hungarian)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.ENG.HUN-LOL", Language.Hungarian)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD.HUN-LOL", Language.Hungarian)]
|
||||
public void should_parse_language(string postTitle, Language language)
|
||||
{
|
||||
var result = Parser.Parser.ParseTitle(postTitle);
|
||||
|
@ -23,6 +23,7 @@ public enum Language
|
||||
Portuguese = 18,
|
||||
Flemish = 19,
|
||||
Greek = 20,
|
||||
Korean = 21
|
||||
Korean = 21,
|
||||
Hungarian = 22
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public static class Parser
|
||||
private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?<subgroup>(?!\s).+?(?<!\s))\](?:_|-|\s|\.)?)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)|(?<dutch>nl\W?subs?)",
|
||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)|(?<dutch>nl\W?subs?)|(?<hungarian>\b(?:HUNDUB|HUN)\b)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_)?(?<year>\d{4})",
|
||||
@ -498,6 +498,9 @@ public static Language ParseLanguage(string title)
|
||||
if (lowerTitle.Contains("portuguese"))
|
||||
return Language.Portuguese;
|
||||
|
||||
if (lowerTitle.Contains("hungarian"))
|
||||
return Language.Hungarian;
|
||||
|
||||
var match = LanguageRegex.Match(title);
|
||||
|
||||
if (match.Groups["italian"].Captures.Cast<Capture>().Any())
|
||||
@ -521,6 +524,9 @@ public static Language ParseLanguage(string title)
|
||||
if (match.Groups["dutch"].Success)
|
||||
return Language.Dutch;
|
||||
|
||||
if (match.Groups["hungarian"].Success)
|
||||
return Language.Hungarian;
|
||||
|
||||
return Language.English;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user