mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 19:52:39 +01:00
parent
d4d4bf8784
commit
f67e11d477
@ -35,6 +35,31 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
result.Should().Be(title.CleanSeriesTitle());
|
||||
}
|
||||
|
||||
[TestCase("Series S03E14 720p HDTV X264-DIMENSION", "Series")]
|
||||
[TestCase("Series.S03E14.720p.HDTV.X264-DIMENSION", "Series")]
|
||||
[TestCase("Series-S03E14-720p-HDTV-X264-DIMENSION", "Series")]
|
||||
[TestCase("Series_S03E14_720p_HDTV_X264-DIMENSION", "Series")]
|
||||
[TestCase("Series 2022 S03E14 720p HDTV X264-DIMENSION", "Series", 2022)]
|
||||
[TestCase("Series (2022) S03E14 720p HDTV X264-DIMENSION", "Series", 2022)]
|
||||
[TestCase("Series.2022.S03E14.720p.HDTV.X264-DIMENSION", "Series", 2022)]
|
||||
[TestCase("Series-2022-S03E14-720p-HDTV-X264-DIMENSION", "Series", 2022)]
|
||||
[TestCase("Series_2022_S03E14_720p_HDTV_X264-DIMENSION", "Series", 2022)]
|
||||
[TestCase("1234 S03E14 720p HDTV X264-DIMENSION", "1234")]
|
||||
[TestCase("1234.S03E14.720p.HDTV.X264-DIMENSION", "1234")]
|
||||
[TestCase("1234-S03E14-720p-HDTV-X264-DIMENSION", "1234")]
|
||||
[TestCase("1234_S03E14_720p_HDTV_X264-DIMENSION", "1234")]
|
||||
[TestCase("1234 2022 S03E14 720p HDTV X264-DIMENSION", "1234", 2022)]
|
||||
[TestCase("1234 (2022) S03E14 720p HDTV X264-DIMENSION", "1234", 2022)]
|
||||
[TestCase("1234.2022.S03E14.720p.HDTV.X264-DIMENSION", "1234", 2022)]
|
||||
[TestCase("1234-2022-S03E14-720p-HDTV-X264-DIMENSION", "1234", 2022)]
|
||||
[TestCase("1234_2022_S03E14_720p_HDTV_X264-DIMENSION", "1234", 2022)]
|
||||
public void should_parse_series_title_info(string postTitle, string titleWithoutYear, int year = 0)
|
||||
{
|
||||
var seriesTitleInfo = Parser.Parser.ParseTitle(postTitle).SeriesTitleInfo;
|
||||
seriesTitleInfo.TitleWithoutYear.Should().Be(titleWithoutYear);
|
||||
seriesTitleInfo.Year.Should().Be(year);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_remove_accents_from_title()
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ namespace NzbDrone.Core.Parser
|
||||
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)|(?<spanish>\b(?:español|castellano)\b)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_)?(?<year>\d{4})",
|
||||
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)[-_. ]+?\(?(?<year>\d{4})\)?",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex TitleComponentsRegex = new Regex(@"^(?:(?<title>.+?) \((?<title>.+?)\)|(?<title>.+?) \| (?<title>.+?))$",
|
||||
|
Loading…
Reference in New Issue
Block a user