mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-15 22:05:02 -05:00
Regex order of placement in list now taken into account when scoring matches.
This commit is contained in:
parent
56e2c28bad
commit
20456fde6b
@ -152,9 +152,10 @@ class NameParser(object):
|
|||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
regex_num = int(re.match('^\d{1,2}', cur_regex_name).group(0))
|
||||||
result = ParseResult(name)
|
result = ParseResult(name)
|
||||||
result.which_regex = [cur_regex_name]
|
result.which_regex = [cur_regex_name]
|
||||||
result.score = 0
|
result.score = 0 - regex_num
|
||||||
|
|
||||||
named_groups = match.groupdict().keys()
|
named_groups = match.groupdict().keys()
|
||||||
|
|
||||||
|
@ -265,29 +265,30 @@ def allPossibleShowNames(show, season=-1):
|
|||||||
if season in [-1, 1]:
|
if season in [-1, 1]:
|
||||||
showNames.append(show.name)
|
showNames.append(show.name)
|
||||||
|
|
||||||
|
if not show.is_anime:
|
||||||
newShowNames = []
|
newShowNames = []
|
||||||
|
|
||||||
country_list = common.countryList
|
country_list = common.countryList
|
||||||
country_list.update(dict(zip(common.countryList.values(), common.countryList.keys())))
|
country_list.update(dict(zip(common.countryList.values(), common.countryList.keys())))
|
||||||
|
for curName in set(showNames):
|
||||||
|
if not curName:
|
||||||
|
continue
|
||||||
|
|
||||||
# if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
|
# if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
|
||||||
# any countries defined in common.countryList
|
# any countries defined in common.countryList
|
||||||
# (and vice versa)
|
# (and vice versa)
|
||||||
if not show.is_anime:
|
|
||||||
for curName in set(showNames):
|
|
||||||
if not curName:
|
|
||||||
continue
|
|
||||||
for curCountry in country_list:
|
for curCountry in country_list:
|
||||||
if curName.endswith(' ' + curCountry):
|
if curName.endswith(' ' + curCountry):
|
||||||
newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
|
newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
|
||||||
elif curName.endswith(' (' + curCountry + ')'):
|
elif curName.endswith(' (' + curCountry + ')'):
|
||||||
newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))
|
newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))
|
||||||
|
|
||||||
|
# if we have "Show Name (2013)" this will strip the (2013) show year from the show name
|
||||||
|
#newShowNames.append(re.sub('\(\d{4}\)','',curName))
|
||||||
|
|
||||||
showNames += newShowNames
|
showNames += newShowNames
|
||||||
|
|
||||||
return showNames
|
return showNames
|
||||||
|
|
||||||
|
|
||||||
def determineReleaseName(dir_name=None, nzb_name=None):
|
def determineReleaseName(dir_name=None, nzb_name=None):
|
||||||
"""Determine a release name from an nzb and/or folder name"""
|
"""Determine a release name from an nzb and/or folder name"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user