Change improve media process to parse anime format 'Show Name 123 - 001 - Ep 1 name'.

This commit is contained in:
JackDandy 2018-01-12 22:12:34 +00:00
parent 7db1743adf
commit 1f057a4f3c
4 changed files with 45 additions and 18 deletions

View file

@ -1,6 +1,7 @@
### 0.14.0 (2018-xx-xx xx:xx:xx UTC)
* Change improve core scheduler logic
* Change improve media process to parse anime format 'Show Name 123 - 001 - Ep 1 name'
[develop changelog]

View file

@ -113,7 +113,7 @@ class NameParser(object):
return
matches = []
initial_best_result = None
for reg_ex in self.compiled_regexes:
for (cur_regex_num, cur_regex_name, cur_regex) in self.compiled_regexes[reg_ex]:
new_name = helpers.remove_non_release_groups(name, 'anime' in cur_regex_name)
@ -266,6 +266,13 @@ class NameParser(object):
# if this is a naming pattern test then return best result
if not show or self.naming_pattern:
if not show and not self.naming_pattern and not self.testing:
# ensure anime regex test but use initial best if show still not found
if 0 == reg_ex:
initial_best_result = best_result
matches = [] # clear non-anime match scores
continue
return initial_best_result
return best_result
# get quality

View file

@ -302,15 +302,15 @@ anime_regexes = [
# Bleach s16e03e04 313-314
'''
^(\[(?P<release_group>.+?)\][ ._-]*)?
(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optinal separator
(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optional separator
[sS](?P<season_num>\d+)[. _-]* # S01 and optional separator
[eE](?P<ep_num>\d+) # epipisode E02
[eE](?P<ep_num>\d+) # episode E02
(([. _-]*e|-) # linking e/- char
(?P<extra_ep_num>\d+))* # additional E03/etc
([ ._-]{2,}|[ ._]+) # if "-" is used to separate at least something else has to be
# there(->{2,}) "s16e03-04-313-314" would make sens any way
(?P<ep_ab_num>\d{1,3}) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and anditional absolute number, all optinal
(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and additional absolute number, all optional
(v(?P<version>[0-9]))? # the version e.g. "v2"
.*?
'''
@ -321,15 +321,15 @@ anime_regexes = [
# Bleach.s16e03-04.313-314
# Bleach s16e03e04 313-314
'''
^(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optinal separator
^(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optional separator
(?P<season_num>\d+)[. _-]* # S01 and optional separator
[xX](?P<ep_num>\d+) # epipisode E02
[xX](?P<ep_num>\d+) # episode E02
(([. _-]*e|-) # linking e/- char
(?P<extra_ep_num>\d+))* # additional E03/etc
([ ._-]{2,}|[ ._]+) # if "-" is used to separate at least something else has to be
# there(->{2,}) "s16e03-04-313-314" would make sens any way
(?P<ep_ab_num>\d{1,3}) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and anditional absolute number, all optinal
(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and additional absolute number, all optional
(v(?P<version>[0-9]))? # the version e.g. "v2"
.*?
'''
@ -338,14 +338,14 @@ anime_regexes = [
('anime_and_normal_reverse',
# Bleach - 313-314 - s16e03-04
'''
^(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optinal separator
(?P<ep_ab_num>\d{1,3}) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and anditional absolute number, all optinal
^(?P<series_name>.+?)[ ._-]+ # start of string and series name and non optional separator
(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p) # absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and additional absolute number, all optional
(v(?P<version>[0-9]))? # the version e.g. "v2"
([ ._-]{2,}|[ ._]+) # if "-" is used to separate at least something else has to be
# there(->{2,}) "s16e03-04-313-314" would make sens any way
[sS](?P<season_num>\d+)[. _-]* # S01 and optional separator
[eE](?P<ep_num>\d+) # epipisode E02
[eE](?P<ep_num>\d+) # episode E02
(([. _-]*e|-) # linking e/- char
(?P<extra_ep_num>\d+))* # additional E03/etc
.*?
@ -355,8 +355,8 @@ anime_regexes = [
('anime_and_normal_front',
# 165.Naruto Shippuuden.s08e014
'''
^(?P<ep_ab_num>\d{1,3}) # start of string and absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and anditional absolute number, all optinal
^(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p) # start of string and absolute number
(-(?P<extra_ab_ep_num>\d{1,3}))* # "-" as separator and additional absolute number, all optional
(v(?P<version>[0-9]))?[ ._-]+ # the version e.g. "v2"
(?P<series_name>.+?)[ ._-]+
[sS](?P<season_num>\d+)[. _-]* # S01 and optional separator
@ -371,7 +371,7 @@ anime_regexes = [
'''
^(?:\[(?P<release_group>.+?)\][ ._-]*)
(?P<series_name>.+?)[ ._-]+
(?P<ep_ab_num>\d{1,3})
(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p)
(-(?P<extra_ab_ep_num>\d{1,3}))*[ ._-]*?
(?:v(?P<version>[0-9])[ ._-]+?)?
(?:.+?[ ._-]+?)?
@ -381,8 +381,19 @@ anime_regexes = [
'''
),
('anime_bare',
('anime_bare_ep',
# One Piece - 102
# Show Name 123 - 001
'''
^(?:\[(?P<release_group>.+?)\][ ._-]*)?
(?P<series_name>.+?)[ ._-]+[ ._-]{2,} # Show_Name and min 2 char separator
(?<!H.)(?P<ep_ab_num>\d{1,3})(?!0p) # 1/001, while avoiding H.264 and 1080p from being matched
(-(?P<extra_ab_ep_num>\d{1,3}))*[ ._-]* # 2/002
(?:v(?P<version>[0-9]))? # v2
'''
),
('anime_bare',
# [ACX]_Wolf's_Spirit_001.mkv
'''
^(\[(?P<release_group>.+?)\][ ._-]*)?

View file

@ -271,10 +271,14 @@ simple_test_cases = {
'165-166.3x3 Eyes.S08E014E015': parser.ParseResult(None, '3x3 Eyes', 8, [14, 15], None, None, None, [165, 166]),
},
'anime_bare': {
'anime_bare_ep': {
'Show Name 123 - 001 - Ep 1 name': parser.ParseResult(None, 'Show Name 123', None, [], None, None, None, [1]),
'One Piece 102': parser.ParseResult(None, 'One Piece', None, [], None, None, None, [102]),
'bleach - 010': parser.ParseResult(None, 'bleach', None, [], None, None, None, [10]),
'Naruto Shippuden - 314v2': parser.ParseResult(None, 'Naruto Shippuden', None, [], None, None, None, [314]),
},
'anime_bare': {
'Blue Submarine No. 6 104-105':
parser.ParseResult(None, 'Blue Submarine No. 6', None, [], None, None, None, [104, 105]),
'Samurai X: Trust & Betrayal (OVA) 001-002':
@ -559,6 +563,10 @@ class BasicTests(test.SickbeardTestDBCase):
np = parser.NameParser(False, TVShow(is_anime=True), testing=True)
self._test_names(np, 'anime_and_normal_front')
def test_anime_bare_ep(self):
np = parser.NameParser(False, TVShow(is_anime=True), testing=True)
self._test_names(np, 'anime_bare_ep')
def test_anime_bare(self):
np = parser.NameParser(False, TVShow(is_anime=True), testing=True)
self._test_names(np, 'anime_bare')