diff --git a/CHANGES.md b/CHANGES.md index 2ab4cd71..443603c9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -91,6 +91,7 @@ * Add X-Fanartname response header for sg.show.getfanart * Change remove some non-release group stuff from newnab results * Add SickGear-NZBGet dedicated post processing script, see.. \autoProcessTV\SickGear-NG\INSTALL.txt +* Add non standard multi episode name parsing e.g. S01E02and03 and 1x02and03and04 [develop changelog] diff --git a/sickbeard/name_parser/regexes.py b/sickbeard/name_parser/regexes.py index 21cc9c85..acf85342 100644 --- a/sickbeard/name_parser/regexes.py +++ b/sickbeard/name_parser/regexes.py @@ -54,6 +54,21 @@ normal_regexes = [ ''' ), + ('non_standard_multi_ep', + # Show Name - S01E02&03 - My Ep Name + # Show Name - S01E02and03 - My Ep Name + ''' + ^((?P.+?)[. _-]+)? # Show_Name and separator + s(?P\d+)[. _-]* # S01 and optional separator + e(?P\d+) # E02 and separator + (([. _-]*and|&|to) # linking and/&/to + (?P(?!(2160|1080|720|480)[pi])\d+))+ # additional E03/etc + [. _-]*((?P.+?) # Source_Quality_Etc- + ((?[^- ]+))?)?$ # Group + ''' + ), + ('standard', # Show.Name.S01E02.Source.Quality.Etc-Group # Show Name - S01E02 - My Ep Name @@ -73,6 +88,22 @@ normal_regexes = [ ''' ), + ('fov_non_standard_multi_ep', + # Show Name - 1x02and03and04 - My Ep Name + ''' + ^((?P.+?)[\[. _-]+)? # Show_Name and separator + (?P\d+)x # 1x + (?P\d+) # 02 and separator + (([. _-]*and|&|to) # linking x/- char + (?P + (?!(2160|1080|720|480)[pi])(?!(?<=x)264) # ignore obviously wrong multi-eps + \d+))+ # additional x03/etc + [\]. _-]*((?P.+?) # Source_Quality_Etc- + ((?[^- ]+))?)?$ # Group + ''' + ), + ('fov', # Show_Name.1x02.Source_Quality_Etc-Group # Show Name - 1x02 - My Ep Name diff --git a/tests/name_parser_tests.py b/tests/name_parser_tests.py index cfee7160..f1742da5 100644 --- a/tests/name_parser_tests.py +++ b/tests/name_parser_tests.py @@ -43,6 +43,13 @@ simple_test_cases = { parser.ParseResult(None, 'Show Name', 1, [2], 'Source.Quality.Etc', 'Group'), }, + 'non_standard_multi_ep': { + 'Show Name - S01E02and03 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'My Ep Name'), + 'Show Name - S01E02and03and04 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'My Ep Name'), + 'Show Name - S01E02to03 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'My Ep Name'), + 'Show Name - S01E02&3&4 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'My Ep Name'), + }, + 'fov': { 'Show_Name.1x02.Source_Quality_Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2], 'Source_Quality_Etc', 'Group'), @@ -59,6 +66,11 @@ simple_test_cases = { 'Show.Name.1x02.WEB-DL': parser.ParseResult(None, 'Show Name', 1, [2], 'WEB-DL'), }, + 'fov_non_standard_multi_ep': { + 'Show_Name.1x02and03and04.Source_Quality_Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Source_Quality_Etc', 'Group'), + }, + 'standard_repeat': { 'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), @@ -429,7 +441,7 @@ class BasicTests(test.SickbeardTestDBCase): try: # self.assertEqual(test_result.which_regex, [section]) self.assertEqual(test_result, result) - except: + except(StandardError, Exception): print('air_by_date:', test_result.is_air_by_date, 'air_date:', test_result.air_date) print('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers) print(test_result) @@ -444,6 +456,10 @@ class BasicTests(test.SickbeardTestDBCase): np = parser.NameParser(False, testing=True) self._test_names(np, 'standard_repeat') + def test_non_standard_multi_ep_names(self): + np = parser.NameParser(False, testing=True) + self._test_names(np, 'non_standard_multi_ep') + def test_fov_names(self): np = parser.NameParser(False, testing=True) self._test_names(np, 'fov') @@ -452,6 +468,10 @@ class BasicTests(test.SickbeardTestDBCase): np = parser.NameParser(False, testing=True) self._test_names(np, 'fov_repeat') + def test_fov_non_standard_multi_ep_names(self): + np = parser.NameParser(False, testing=True) + self._test_names(np, 'fov_non_standard_multi_ep') + def test_bare_names(self): np = parser.NameParser(False, testing=True) self._test_names(np, 'bare')