Add non standard multi episode name parsing e.g. S01E02and03 and 1x02and03and04.

This commit is contained in:
JackDandy 2018-02-07 02:00:33 +00:00
parent cf43fba810
commit d89c8a0fb3
3 changed files with 53 additions and 1 deletions

View file

@ -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]

View file

@ -54,6 +54,21 @@ normal_regexes = [
'''
),
('non_standard_multi_ep',
# Show Name - S01E02&03 - My Ep Name
# Show Name - S01E02and03 - My Ep Name
'''
^((?P<series_name>.+?)[. _-]+)? # Show_Name and separator
s(?P<season_num>\d+)[. _-]* # S01 and optional separator
e(?P<ep_num>\d+) # E02 and separator
(([. _-]*and|&|to) # linking and/&/to
(?P<extra_ep_num>(?!(2160|1080|720|480)[pi])\d+))+ # additional E03/etc
[. _-]*((?P<extra_info>.+?) # Source_Quality_Etc-
((?<![. _-])(?<!WEB) # Make sure this is really the release group
-(?P<release_group>[^- ]+))?)?$ # 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<series_name>.+?)[\[. _-]+)? # Show_Name and separator
(?P<season_num>\d+)x # 1x
(?P<ep_num>\d+) # 02 and separator
(([. _-]*and|&|to) # linking x/- char
(?P<extra_ep_num>
(?!(2160|1080|720|480)[pi])(?!(?<=x)264) # ignore obviously wrong multi-eps
\d+))+ # additional x03/etc
[\]. _-]*((?P<extra_info>.+?) # Source_Quality_Etc-
((?<![. _-])(?<!WEB) # Make sure this is really the release group
-(?P<release_group>[^- ]+))?)?$ # Group
'''
),
('fov',
# Show_Name.1x02.Source_Quality_Etc-Group
# Show Name - 1x02 - My Ep Name

View file

@ -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')