Merge pull request #726 from JackDandy/feature/ChangeNewznab

Change nzbs.org anime search category and fix newznab anime backlog…
This commit is contained in:
JackDandy 2016-07-02 18:28:49 +01:00 committed by GitHub
commit 515a00dcef
4 changed files with 20 additions and 12 deletions

View file

@ -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 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 * Add sorting to "Provider" column and fix sorting of "Remove" column on Manage Failed Downloads
* Fix "Limit" drop down 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) ### 0.11.12 (2016-06-20 02:20:00 UTC)

View file

@ -37,14 +37,14 @@ class AnizbProvider(generic.NZBProvider):
for mode in search_params.keys(): for mode in search_params.keys():
for params in search_params[mode]: 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) data = self.cache.getRSSFeed(search_url)
time.sleep(1.1) time.sleep(1.1)
cnt = len(results) cnt = len(results)
for entry in (data and data.get('entries', []) or []): for entry in (data and data.get('entries', []) or []):
if entry.get('title') and entry.get('link', '').startswith('http'): 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) self.log_result(mode=mode, count=len(results) - cnt, url=search_url)

View file

@ -647,7 +647,7 @@ class NZBProvider(object, GenericProvider):
if result_date: if result_date:
result_date = datetime.datetime(*result_date[0:6]) result_date = datetime.datetime(*result_date[0:6])
else: 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 continue
if not search_date or search_date < result_date: if not search_date or search_date < result_date:

View file

@ -129,7 +129,8 @@ class NewznabProvider(generic.NZBProvider):
# id search # id search
ids = helpers.mapIndexersToShow(ep_obj.show) 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() params = base_params.copy()
use_id = False use_id = False
if ids[1] and self.supports_tvdbid(): if ids[1] and self.supports_tvdbid():
@ -144,15 +145,18 @@ class NewznabProvider(generic.NZBProvider):
name_exceptions = list( name_exceptions = list(
set([helpers.sanitizeSceneName(a) for a in set([helpers.sanitizeSceneName(a) for a in
scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) 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: for cur_exception in name_exceptions:
params = base_params.copy() params = base_params.copy()
cur_exception = cur_exception.replace('.', spacer)
if 'q' in params: 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) search_params.append(params)
if ep_detail: if ep_detail:
params = base_params.copy() 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') 'season' in params and params.pop('season')
'ep' in params and params.pop('ep') 'ep' in params and params.pop('ep')
search_params.append(params) search_params.append(params)
@ -177,7 +181,7 @@ class NewznabProvider(generic.NZBProvider):
elif ep_obj.show.is_anime: elif ep_obj.show.is_anime:
base_params['ep'] = '%i' % (helpers.tryInt(ep_obj.scene_absolute_number) or base_params['ep'] = '%i' % (helpers.tryInt(ep_obj.scene_absolute_number) or
helpers.tryInt(ep_obj.scene_episode)) helpers.tryInt(ep_obj.scene_episode))
ep_detail = '%02d' % base_params['ep'] ep_detail = '%02d' % helpers.tryInt(base_params['ep'])
else: else:
base_params['season'], base_params['ep'] = ( 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] (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 # id search
ids = helpers.mapIndexersToShow(ep_obj.show) 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() params = base_params.copy()
use_id = False use_id = False
if ids[1]: if ids[1]:
@ -204,14 +209,16 @@ class NewznabProvider(generic.NZBProvider):
set([helpers.sanitizeSceneName(a) for a in set([helpers.sanitizeSceneName(a) for a in
scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) 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: for cur_exception in name_exceptions:
params = base_params.copy() params = base_params.copy()
cur_exception = cur_exception.replace('.', spacer)
params['q'] = cur_exception params['q'] = cur_exception
search_params.append(params) search_params.append(params)
if ep_detail: if ep_detail:
params = base_params.copy() 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') 'season' in params and params.pop('season')
'ep' in params and params.pop('ep') 'ep' in params and params.pop('ep')
search_params.append(params) search_params.append(params)
@ -244,9 +251,7 @@ class NewznabProvider(generic.NZBProvider):
# category ids # category ids
cat = [] cat = []
cat_sport = ['5060'] cat_sport = ['5060']
cat_anime = [] cat_anime = (['5070'], ['6070,7040'])['nzbs_org' == self.get_id()]
if 'nzbgeek' != self.get_id():
cat_anime = (['5070'], ['6070'])['nzbs_org' == self.get_id()]
if 'Episode' == mode or 'Season' == mode: if 'Episode' == mode or 'Season' == mode:
if not ('rid' in params or 'tvdbid' in params or 'q' in params or not self.supports_tvdbid()): 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.') logger.log('Error no rid, tvdbid, or search term available for search.')