From 979da54cbf47973757f84525ab1e217d6906473d Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sat, 2 Jul 2016 16:06:50 +0100 Subject: [PATCH] Change nzbs.org anime search category and fix newznab anime backlog search Change improve nzbgeek search response Change use query search at 6box (id search fails) --- CHANGES.md | 3 +++ sickbeard/providers/anizb.py | 4 ++-- sickbeard/providers/generic.py | 2 +- sickbeard/providers/newznab.py | 23 ++++++++++++++--------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6db214eb..d4e25465 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -94,6 +94,9 @@ * Add number of items shown to Manage Failed Downloads table footer and indicate if number of shown items is limited * Add sorting to "Provider" column and fix sorting of "Remove" column on Manage Failed Downloads * Fix "Limit" drop down on Manage Failed Downloads +* Change nzbs.org anime search category and fix newznab anime backlog search +* Change improve nzbgeek search response +* Change use query search at 6box (id search fails) ### 0.11.12 (2016-06-20 02:20:00 UTC) diff --git a/sickbeard/providers/anizb.py b/sickbeard/providers/anizb.py index 79869ce7..3591f287 100644 --- a/sickbeard/providers/anizb.py +++ b/sickbeard/providers/anizb.py @@ -37,14 +37,14 @@ class AnizbProvider(generic.NZBProvider): for mode in search_params.keys(): for params in search_params[mode]: - search_url = '%sapi/%s' % (self.url, params and ('?q=%s' % params) or '') + search_url = '%sapi/%s' % (self.url, params and (('?q=%s', '?q=%(q)s')['q' in params] % params) or '') data = self.cache.getRSSFeed(search_url) time.sleep(1.1) cnt = len(results) for entry in (data and data.get('entries', []) or []): if entry.get('title') and entry.get('link', '').startswith('http'): - results.append((entry['title'], entry['link'], None, None)) + results.append(entry) self.log_result(mode=mode, count=len(results) - cnt, url=search_url) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index b81d616b..c7d8577c 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -647,7 +647,7 @@ class NZBProvider(object, GenericProvider): if result_date: result_date = datetime.datetime(*result_date[0:6]) else: - logger.log(u'Unable to figure out the date for entry %s, skipping it', title) + logger.log(u'Unable to figure out the date for entry %s, skipping it' % title) continue if not search_date or search_date < result_date: diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index aab020f9..208a5ef0 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -129,7 +129,8 @@ class NewznabProvider(generic.NZBProvider): # id search ids = helpers.mapIndexersToShow(ep_obj.show) - if ids[1]: # or ids[2]: + ids_fail = '6box' in self.name + if not ids_fail and ids[1]: # or ids[2]: params = base_params.copy() use_id = False if ids[1] and self.supports_tvdbid(): @@ -144,15 +145,18 @@ class NewznabProvider(generic.NZBProvider): name_exceptions = list( set([helpers.sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) + + spacer = 'geek' in self.get_id() and ' ' or '.' for cur_exception in name_exceptions: params = base_params.copy() + cur_exception = cur_exception.replace('.', spacer) if 'q' in params: - params['q'] = '%s.%s' % (cur_exception, params['q']) + params['q'] = '%s%s%s' % (cur_exception, spacer, params['q']) search_params.append(params) if ep_detail: params = base_params.copy() - params['q'] = '%s.%s' % (cur_exception, ep_detail) + params['q'] = '%s%s%s' % (cur_exception, spacer, ep_detail) 'season' in params and params.pop('season') 'ep' in params and params.pop('ep') search_params.append(params) @@ -177,7 +181,7 @@ class NewznabProvider(generic.NZBProvider): elif ep_obj.show.is_anime: base_params['ep'] = '%i' % (helpers.tryInt(ep_obj.scene_absolute_number) or helpers.tryInt(ep_obj.scene_episode)) - ep_detail = '%02d' % base_params['ep'] + ep_detail = '%02d' % helpers.tryInt(base_params['ep']) else: base_params['season'], base_params['ep'] = ( (ep_obj.season, ep_obj.episode), (ep_obj.scene_season, ep_obj.scene_episode))[ep_obj.show.is_scene] @@ -187,7 +191,8 @@ class NewznabProvider(generic.NZBProvider): # id search ids = helpers.mapIndexersToShow(ep_obj.show) - if ids[1]: # or ids[2]: + ids_fail = '6box' in self.name + if not ids_fail and ids[1]: # or ids[2]: params = base_params.copy() use_id = False if ids[1]: @@ -204,14 +209,16 @@ class NewznabProvider(generic.NZBProvider): set([helpers.sanitizeSceneName(a) for a in scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) + spacer = 'geek' in self.get_id() and ' ' or '.' for cur_exception in name_exceptions: params = base_params.copy() + cur_exception = cur_exception.replace('.', spacer) params['q'] = cur_exception search_params.append(params) if ep_detail: params = base_params.copy() - params['q'] = '%s.%s' % (cur_exception, ep_detail) + params['q'] = '%s%s%s' % (cur_exception, spacer, ep_detail) 'season' in params and params.pop('season') 'ep' in params and params.pop('ep') search_params.append(params) @@ -244,9 +251,7 @@ class NewznabProvider(generic.NZBProvider): # category ids cat = [] cat_sport = ['5060'] - cat_anime = [] - if 'nzbgeek' != self.get_id(): - cat_anime = (['5070'], ['6070'])['nzbs_org' == self.get_id()] + cat_anime = (['5070'], ['6070,7040'])['nzbs_org' == self.get_id()] if 'Episode' == mode or 'Season' == mode: if not ('rid' in params or 'tvdbid' in params or 'q' in params or not self.supports_tvdbid()): logger.log('Error no rid, tvdbid, or search term available for search.')