From a574012c38f96159122fee736f0ecbd863ac35c1 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Fri, 25 Sep 2015 15:33:25 +0100 Subject: [PATCH] Change increase the scope and number of non release group text that is identified and removed. --- CHANGES.md | 1 + sickbeard/helpers.py | 16 ++++++++++++---- sickbeard/name_parser/parser.py | 2 +- sickbeard/postProcessor.py | 4 +--- sickbeard/tvcache.py | 6 +++--- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 571fa638..1add630f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index dc0fe958..871fb0d2 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -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 diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index b8ba97ce..e0946daa 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -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: diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 5800a9db..7583023c 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -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
.. into %s' % (name, str(parse_result).decode('utf-8', 'xmlcharrefreplace')), logger.DEBUG) + self._log(u'Parsed %s
.. from %s' % (str(parse_result).decode('utf-8', 'xmlcharrefreplace'), name), logger.DEBUG) if parse_result.is_air_by_date: season = -1 diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 7c60daf6..3711fd6a 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -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: