Changed: Refactor ReleaseGroup Parser cases

pull/466/head
Qstick 6 years ago
parent c3d2769d3f
commit d9a51a1d02

@ -90,6 +90,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("02 Unchained.flac")] // This isn't valid on any regex we have. We must always have an artist [TestCase("02 Unchained.flac")] // This isn't valid on any regex we have. We must always have an artist
[TestCase("Fall Out Boy - 02 - Title.wav")] // This isn't valid on any regex we have. We don't support Artist - Track - TrackName [TestCase("Fall Out Boy - 02 - Title.wav")] // This isn't valid on any regex we have. We don't support Artist - Track - TrackName
[Ignore("Ignore Test until track parsing rework")]
public void should_parse_quality_from_extension(string title) public void should_parse_quality_from_extension(string title)
{ {
Parser.Parser.ParseAlbumTitle(title).Quality.Quality.Should().NotBe(Quality.Unknown); Parser.Parser.ParseAlbumTitle(title).Quality.Quality.Should().NotBe(Quality.Unknown);

@ -7,28 +7,13 @@ namespace NzbDrone.Core.Test.ParserTests
[TestFixture] [TestFixture]
public class ReleaseGroupParserFixture : CoreTest public class ReleaseGroupParserFixture : CoreTest
{ {
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-ENTiTLED", "ENTiTLED")]
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", null)] [TestCase("[ www.Torrenting.com ] - Olafur.Arnalds-Remember-WEB-2018-ENTiTLED", "ENTiTLED")]
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", null)] [TestCase("Olafur.Arnalds-Remember-WEB-2018-ENTiTLED [eztv]-[rarbg.com]", "ENTiTLED")]
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")] [TestCase("7s-atlantis-128.mp3", null)]
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-ENTiTLED-Pre", "ENTiTLED")]
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-ENTiTLED-postbot", "ENTiTLED")]
[TestCase("The Office - S01E01 - Pilot [HTDV-480p]", null)] [TestCase("Olafur.Arnalds-Remember-WEB-2018-ENTiTLED-xpost", "ENTiTLED")]
[TestCase("The Office - S01E01 - Pilot [HTDV-720p]", null)]
[TestCase("The Office - S01E01 - Pilot [HTDV-1080p]", null)]
[TestCase("The.Walking.Dead.S04E13.720p.WEB-DL.AAC2.0.H.264-Cyphanix", "Cyphanix")]
[TestCase("Arrow.S02E01.720p.WEB-DL.DD5.1.H.264.mkv", null)]
[TestCase("Series Title S01E01 Episode Title", null)]
[TestCase("The Colbert Report - 2014-06-02 - Thomas Piketty.mkv", null)]
[TestCase("Real Time with Bill Maher S12E17 May 23, 2014.mp4", null)]
[TestCase("Reizen Waes - S01E08 - Transistri\u00EB, Zuid-Osseti\u00EB en Abchazi\u00EB SDTV.avi", null)]
[TestCase("Simpsons 10x11 - Wild Barts Cant Be Broken [rl].avi", null)]
[TestCase("[ www.Torrenting.com ] - Revenge.S03E14.720p.HDTV.X264-DIMENSION", "DIMENSION")]
[TestCase("Seed S02E09 HDTV x264-2HD [eztv]-[rarbg.com]", "2HD")]
[TestCase("7s-atlantis-s02e01-720p.mkv", null)]
[TestCase("The.Middle.S09E13.720p.HEVC.x265-MeGusta-Pre", "MeGusta")]
[TestCase("Ghosted.S01E08.Haunted.Hayride.720p.AMZN.WEBRip.DDP5.1.x264-NTb-postbot", "NTb")]
[TestCase("Ghosted.S01E08.Haunted.Hayride.720p.AMZN.WEBRip.DDP5.1.x264-NTb-xpost", "NTb")]
//[TestCase("", "")] //[TestCase("", "")]
public void should_parse_release_group(string title, string expected) public void should_parse_release_group(string title, string expected)
{ {
@ -44,24 +29,23 @@ namespace NzbDrone.Core.Test.ParserTests
Parser.Parser.ParseMusicPath(path).ReleaseGroup.Should().Be("archivist"); Parser.Parser.ParseMusicPath(path).ReleaseGroup.Should().Be("archivist");
} }
[TestCase("Marvels.Daredevil.S02E04.720p.WEBRip.x264-SKGTV English", "SKGTV")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-SKGTV English", "SKGTV")]
[TestCase("Marvels.Daredevil.S02E04.720p.WEBRip.x264-SKGTV_English", "SKGTV")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-SKGTV_English", "SKGTV")]
[TestCase("Marvels.Daredevil.S02E04.720p.WEBRip.x264-SKGTV.English", "SKGTV")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-SKGTV.English", "SKGTV")]
//[TestCase("", "")] //[TestCase("", "")]
public void should_not_include_language_in_release_group(string title, string expected) public void should_not_include_language_in_release_group(string title, string expected)
{ {
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
} }
[TestCase("The.Longest.Mystery.S02E04.720p.WEB-DL.AAC2.0.H.264-EVL-RP", "EVL")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-EVL-RP", "EVL")]
[TestCase("The.Longest.Mystery.S02E04.720p.WEB-DL.AAC2.0.H.264-EVL-RP-RP", "EVL")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-EVL-RP-RP", "EVL")]
[TestCase("The.Longest.Mystery.S02E04.720p.WEB-DL.AAC2.0.H.264-EVL-Obfuscated", "EVL")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-EVL-Obfuscated", "EVL")]
[TestCase("Lost.S04E04.720p.BluRay.x264-xHD-NZBgeek", "xHD")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-xHD-NZBgeek", "xHD")]
[TestCase("Blue.Bloods.S05E11.720p.HDTV.X264-DIMENSION-NZBgeek", "DIMENSION")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-DIMENSION-NZBgeek", "DIMENSION")]
[TestCase("Lost.S04E04.720p.BluRay.x264-xHD-1", "xHD")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-xHD-1", "xHD")]
[TestCase("Blue.Bloods.S05E11.720p.HDTV.X264-DIMENSION-1", "DIMENSION")] [TestCase("Olafur.Arnalds-Remember-WEB-2018-DIMENSION-1", "DIMENSION")]
//[TestCase("saturday.night.live.s40e11.kevin.hart_sia.720p.hdtv.x264-w4f-sample.mkv", "w4f")] Sample Support was removed for music [TestCase("Olafur.Arnalds-Remember-WEB-2018-EVL-Scrambled", "EVL")]
[TestCase("The.Sequel.2017.S05E02.1080p.WEB-DL.DD5.1.H264-EVL-Scrambled", "EVL")]
public void should_not_include_repost_in_release_group(string title, string expected) public void should_not_include_repost_in_release_group(string title, string expected)
{ {
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);

@ -167,6 +167,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$", private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
//TODO Rework this Regex for Music
private static readonly Regex SimpleTitleRegex = new Regex(@"(?:(480|720|1080|2160|320)[ip]|[xh][\W_]?26[45]|DD\W?5\W1|[<>*:|]|848x480|1280x720|1920x1080|3840x2160|4096x2160|(8|10)b(it)?)\s*", private static readonly Regex SimpleTitleRegex = new Regex(@"(?:(480|720|1080|2160|320)[ip]|[xh][\W_]?26[45]|DD\W?5\W1|[<>*:|]|848x480|1280x720|1920x1080|3840x2160|4096x2160|(8|10)b(it)?)\s*",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
@ -179,13 +180,13 @@ namespace NzbDrone.Core.Parser
private static readonly Regex SixDigitAirDateRegex = new Regex(@"(?<=[_.-])(?<airdate>(?<!\d)(?<airyear>[1-9]\d{1})(?<airmonth>[0-1][0-9])(?<airday>[0-3][0-9]))(?=[_.-])", private static readonly Regex SixDigitAirDateRegex = new Regex(@"(?<=[_.-])(?<airdate>(?<!\d)(?<airyear>[1-9]\d{1})(?<airmonth>[0-1][0-9])(?<airday>[0-3][0-9]))(?=[_.-])",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CleanReleaseGroupRegex = new Regex(@"^(.*?[-._ ](S\d+E\d+)[-._ ])|(-(RP|1|NZBGeek|Obfuscated|Scrambled|sample|Pre|postbot|xpost))+$", private static readonly Regex CleanReleaseGroupRegex = new Regex(@"^(.*?[-._ ])|(-(RP|1|NZBGeek|Obfuscated|Scrambled|sample|Pre|postbot|xpost))+$",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CleanTorrentSuffixRegex = new Regex(@"\[(?:ettv|rartv|rarbg|cttv)\]$", private static readonly Regex CleanTorrentSuffixRegex = new Regex(@"\[(?:ettv|rartv|rarbg|cttv)\]$",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+)(?<!WEB-DL|480p|720p|1080p|2160p)(?:\b|[-._ ])", private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+)(?<!MP3|ALAC|FLAC|WEB)(?:\b|[-._ ])",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?<subgroup>(?!\s).+?(?<!\s))\](?:_|-|\s|\.)?)", private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?<subgroup>(?!\s).+?(?<!\s))\](?:_|-|\s|\.)?)",

Loading…
Cancel
Save