From 11d283910e6711265e7b3aa730324e00cb54d918 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Sat, 26 Aug 2017 17:30:52 +0200 Subject: [PATCH] Change prevent indexer specific release name parts from fudging search logic. --- CHANGES.md | 7 ++++++- sickbeard/providers/newznab.py | 15 +++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3b6cb287..fdc27595 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.12.27 (2017-08-22 19:00:00 UTC) +### 0.12.28 (2017-08-26 18:15:00 UTC) + +* Change prevent indexer specific release name parts from fudging search logic + + +### 0.12.27 (2017-08-22 19:00:00 UTC) * Update to UnRar 5.50 release diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 3e258547..974eada7 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -411,13 +411,20 @@ class NewznabProvider(generic.NZBProvider): def _title_and_url(self, item): title, url = None, None try: - title = item.findtext('title') - url = item.findtext('link') + title = ('%s' % item.findtext('title')).strip() + title = re.sub(r'\s+', '.', title) + # remove indexer specific release name parts + r_found = True + while r_found: + r_found = False + for pattern, repl in ((r'(?i)-Obfuscated$', ''), (r'(?i)-postbot$', '')): + if re.search(pattern, title): + r_found = True + title = re.sub(pattern, repl, title) + url = str(item.findtext('link')).replace('&', '&') except (StandardError, Exception): pass - title = title and re.sub(r'\s+', '.', '%s' % title) - url = url and str(url).replace('&', '&') return title, url