Merge pull request #522 from JackDandy/feature/ChangeRemoveNonReleaseGroups

Change increase the scope and number of non release group text that …
This commit is contained in:
JackDandy 2015-10-16 14:10:40 +01:00
commit fb484efba0
5 changed files with 18 additions and 11 deletions

View file

@ -52,6 +52,7 @@
* Change increase frequency of updating show data
* Remove FreshOnTV (TvT) torrent provider
* Remove Strike torrent provider
* Change increase the scope and number of non release group text that is identified and removed
[develop changelog]
Enable Alpha Ratio again now that the secure login page over https is fixed

View file

@ -99,10 +99,18 @@ def remove_non_release_groups(name):
Remove non release groups from name
"""
if name and "-" in name:
name_group = name.rsplit('-', 1)
if name_group[-1].upper() in ["RP", "NZBGEEK"]:
name = name_group[0]
if name:
rc = [re.compile(r'(?i)' + v) for v in
'([\s\.\-_\[\{\(]*(no-rar|nzbgeek|ripsalot|rp|siklopentan)[\s\.\-_\]\}\)]*)$',
'(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*(www\.\w+.\w+)[\s\.\-_]*[\]\}\)][\s\.\-_]*)$',
'(?<=\w)([\s\.\-_]*[\[\{\(]\s*(rar(bg|tv)|((e[tz]|v)tv))[\s\.\-_]*[\]\}\)][\s\.\-_]*)$',
'(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*[\w\s\.\-\_]+[\s\.\-_]*[\]\}\)][\s\.\-_]*)$'
]
rename = name
while rename:
for regex in rc:
name = regex.sub('', name)
rename = (name, False)[name == rename]
return name

View file

@ -180,7 +180,7 @@ class NameParser(object):
result.score += 1
if 'release_group' in named_groups:
result.release_group = match.group('release_group')
result.release_group = helpers.remove_non_release_groups(match.group('release_group'))
result.score += 1
if 'version' in named_groups:

View file

@ -467,12 +467,10 @@ class PostProcessor(object):
if not name:
return to_return
name = helpers.remove_non_release_groups(helpers.remove_extension(name))
# parse the name to break it into show name, season, and episode
np = NameParser(resource, try_scene_exceptions=True, convert=True)
parse_result = np.parse(name)
self._log(u'Parsed %s<br />.. into %s' % (name, str(parse_result).decode('utf-8', 'xmlcharrefreplace')), logger.DEBUG)
self._log(u'Parsed %s<br />.. from %s' % (str(parse_result).decode('utf-8', 'xmlcharrefreplace'), name), logger.DEBUG)
if parse_result.is_air_by_date:
season = -1

View file

@ -207,13 +207,13 @@ class TVCache:
showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
try:
myParser = NameParser(showObj=showObj, convert=True)
parse_result = myParser.parse(name)
np = NameParser(showObj=showObj, convert=True)
parse_result = np.parse(name)
except InvalidNameException:
logger.log(u'Unable to parse the filename ' + name + ' into a valid episode', logger.DEBUG)
return None
except InvalidShowException:
logger.log(u'Unable to parse the filename ' + name + ' into a valid show', logger.DEBUG)
logger.log(u'No show in the db matches filename ' + name + ' not cached', logger.DEBUG)
return None
if not parse_result or not parse_result.series_name: