mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Merge pull request #1058 from JackDandy/feature/ChangeNameParser
Add non standard multi episode name parsing…
This commit is contained in:
commit
2c2354ca5d
3 changed files with 53 additions and 1 deletions
|
@ -91,6 +91,7 @@
|
||||||
* Add X-Fanartname response header for sg.show.getfanart
|
* Add X-Fanartname response header for sg.show.getfanart
|
||||||
* Change remove some non-release group stuff from newnab results
|
* Change remove some non-release group stuff from newnab results
|
||||||
* Add SickGear-NZBGet dedicated post processing script, see.. \autoProcessTV\SickGear-NG\INSTALL.txt
|
* 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]
|
[develop changelog]
|
||||||
|
|
||||||
|
|
|
@ -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',
|
('standard',
|
||||||
# Show.Name.S01E02.Source.Quality.Etc-Group
|
# Show.Name.S01E02.Source.Quality.Etc-Group
|
||||||
# Show Name - S01E02 - My Ep Name
|
# 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',
|
('fov',
|
||||||
# Show_Name.1x02.Source_Quality_Etc-Group
|
# Show_Name.1x02.Source_Quality_Etc-Group
|
||||||
# Show Name - 1x02 - My Ep Name
|
# Show Name - 1x02 - My Ep Name
|
||||||
|
|
|
@ -43,6 +43,13 @@ simple_test_cases = {
|
||||||
parser.ParseResult(None, 'Show Name', 1, [2], 'Source.Quality.Etc', 'Group'),
|
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': {
|
'fov': {
|
||||||
'Show_Name.1x02.Source_Quality_Etc-Group':
|
'Show_Name.1x02.Source_Quality_Etc-Group':
|
||||||
parser.ParseResult(None, 'Show Name', 1, [2], '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'),
|
'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': {
|
'standard_repeat': {
|
||||||
'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group':
|
'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group':
|
||||||
parser.ParseResult(None, 'Show Name', 1, [2, 3], '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:
|
try:
|
||||||
# self.assertEqual(test_result.which_regex, [section])
|
# self.assertEqual(test_result.which_regex, [section])
|
||||||
self.assertEqual(test_result, result)
|
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('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('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers)
|
||||||
print(test_result)
|
print(test_result)
|
||||||
|
@ -444,6 +456,10 @@ class BasicTests(test.SickbeardTestDBCase):
|
||||||
np = parser.NameParser(False, testing=True)
|
np = parser.NameParser(False, testing=True)
|
||||||
self._test_names(np, 'standard_repeat')
|
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):
|
def test_fov_names(self):
|
||||||
np = parser.NameParser(False, testing=True)
|
np = parser.NameParser(False, testing=True)
|
||||||
self._test_names(np, 'fov')
|
self._test_names(np, 'fov')
|
||||||
|
@ -452,6 +468,10 @@ class BasicTests(test.SickbeardTestDBCase):
|
||||||
np = parser.NameParser(False, testing=True)
|
np = parser.NameParser(False, testing=True)
|
||||||
self._test_names(np, 'fov_repeat')
|
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):
|
def test_bare_names(self):
|
||||||
np = parser.NameParser(False, testing=True)
|
np = parser.NameParser(False, testing=True)
|
||||||
self._test_names(np, 'bare')
|
self._test_names(np, 'bare')
|
||||||
|
|
Loading…
Reference in a new issue