From 2083dfdb30a274e306d0bb2020b078ad9de04ca0 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Mon, 30 Mar 2015 00:15:25 +0100 Subject: [PATCH] Change prevent wasted API hit where show and exception names create a duplicate sanitised year. --- CHANGES.md | 1 + sickbeard/providers/btn.py | 8 ++++---- sickbeard/providers/newznab.py | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ce9f1c5b..e1247e27 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ * Remove listed hacks.txt record for check that SSLv3 is available because issue was addressed by vendor * Update chardet packages 2.2.1 to 2.3.0 (ff40135) * Update cachecontrol library 0.9.3 to 0.11.2 +* Change prevent wasted API hit where show and exception names create a duplicate sanitised year * Add ToTV provider * Fix Backlog scheduler initialization and change backlog frequency from minutes to days * Change to consolidate and tidy some provider code diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index 03a0e52d..73361a4e 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -197,11 +197,11 @@ class BTNProvider(generic.TorrentProvider): search_params.append(current_params) else: name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + set([sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) for name in name_exceptions: # Search by name if we don't have tvdb or tvrage id cur_return = current_params.copy() - cur_return['series'] = sanitizeSceneName(name) + cur_return['series'] = name search_params.append(cur_return) return search_params @@ -235,10 +235,10 @@ class BTNProvider(generic.TorrentProvider): else: # add new query string for every exception name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + set([sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) for cur_exception in name_exceptions: cur_return = search_params.copy() - cur_return['series'] = sanitizeSceneName(cur_exception) + cur_return['series'] = cur_exception to_return.append(cur_return) return to_return diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 939f70f4..428d9a19 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -150,11 +150,11 @@ class NewznabProvider(generic.NZBProvider): # add new query strings for exceptions name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + set([helpers.sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) for cur_exception in name_exceptions: cur_return = cur_params.copy() if 'q' in cur_return: - cur_return['q'] = helpers.sanitizeSceneName(cur_exception) + '.' + cur_return['q'] + cur_return['q'] = cur_exception + '.' + cur_return['q'] to_return.append(cur_return) return to_return @@ -185,10 +185,10 @@ class NewznabProvider(generic.NZBProvider): # add new query strings for exceptions name_exceptions = list( - set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])) + set([helpers.sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) for cur_exception in name_exceptions: cur_return = params.copy() - cur_return['q'] = helpers.sanitizeSceneName(cur_exception) + cur_return['q'] = cur_exception to_return.append(cur_return) if ep_obj.show.anime: @@ -196,7 +196,7 @@ class NewznabProvider(generic.NZBProvider): # Remove the ?ep=e46 paramater and use add the episode number to the query paramater. # Can be usefull for newznab indexers that do not have the episodes 100% parsed. # Start with only applying the searchstring to anime shows - params['q'] = helpers.sanitizeSceneName(cur_exception) + params['q'] = cur_exception paramsNoEp = params.copy() paramsNoEp['q'] = '%s.%02d' % (paramsNoEp['q'], int(paramsNoEp['ep']))