Merge pull request #338 from JackDandy/feature/ChangeReduceApiHits

Change prevent wasted API hit where show and exception names create a du...
This commit is contained in:
JackDandy 2015-04-29 02:20:00 +01:00
commit e8a1303ef7
3 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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']))