2016-08-21 20:31:18 +00:00
|
|
|
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
2014-03-10 05:18:05 +00:00
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
|
# This file is part of SickGear.
|
2014-03-10 05:18:05 +00:00
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
|
# SickGear is free software: you can redistribute it and/or modify
|
2014-03-10 05:18:05 +00:00
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
|
# SickGear is distributed in the hope that it will be useful,
|
2014-03-10 05:18:05 +00:00
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2014-11-12 16:43:14 +00:00
|
|
|
|
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2014-05-17 09:27:17 +00:00
|
|
|
|
import time
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
|
|
import sickbeard
|
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
from . import generic
|
|
|
|
|
from sickbeard import helpers, logger, scene_exceptions, tvcache
|
2015-04-18 04:55:04 +00:00
|
|
|
|
from sickbeard.exceptions import AuthException
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
|
class NewznabProvider(generic.NZBProvider):
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
def __init__(self, name, url, key='', cat_ids=None, search_mode=None,
|
2015-06-19 16:47:52 +00:00
|
|
|
|
search_fallback=False, enable_recentsearch=False, enable_backlog=False):
|
2015-04-18 04:55:04 +00:00
|
|
|
|
generic.NZBProvider.__init__(self, name, True, False)
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
|
self.url = url
|
|
|
|
|
self.key = key
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
self.cat_ids = cat_ids or '5030,5040'
|
|
|
|
|
self.search_mode = search_mode or 'eponly'
|
2014-05-17 05:23:11 +00:00
|
|
|
|
self.search_fallback = search_fallback
|
2014-12-22 18:30:53 +00:00
|
|
|
|
self.enable_recentsearch = enable_recentsearch
|
2014-08-29 05:16:25 +00:00
|
|
|
|
self.enable_backlog = enable_backlog
|
2015-06-19 16:47:52 +00:00
|
|
|
|
self.needs_auth = '0' != self.key.strip() # '0' in the key setting indicates that api_key is not needed
|
|
|
|
|
self.default = False
|
|
|
|
|
self.cache = NewznabCache(self)
|
2014-05-17 05:23:11 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
def check_auth_from_data(self, data):
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if data is None:
|
2015-07-13 09:39:20 +00:00
|
|
|
|
return self._check_auth()
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if 'error' in data.feed:
|
|
|
|
|
code = data.feed['error']['code']
|
2014-09-01 15:57:52 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if '100' == code:
|
|
|
|
|
raise AuthException('Your API key for %s is incorrect, check your config.' % self.name)
|
|
|
|
|
elif '101' == code:
|
|
|
|
|
raise AuthException('Your account on %s has been suspended, contact the admin.' % self.name)
|
|
|
|
|
elif '102' == code:
|
|
|
|
|
raise AuthException('Your account isn\'t allowed to use the API on %s, contact the admin.' % self.name)
|
|
|
|
|
elif '910' == code:
|
|
|
|
|
logger.log(u'%s currently has their API disabled, please check with provider.' % self.name,
|
|
|
|
|
logger.WARNING)
|
|
|
|
|
else:
|
|
|
|
|
logger.log(u'Unknown error given from %s: %s' % (self.name, data.feed['error']['description']),
|
|
|
|
|
logger.ERROR)
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
return True
|
2014-09-01 15:57:52 +00:00
|
|
|
|
|
|
|
|
|
def get_newznab_categories(self):
|
|
|
|
|
"""
|
|
|
|
|
Uses the newznab provider url and apikey to get the capabilities.
|
|
|
|
|
Makes use of the default newznab caps param. e.a. http://yournewznab/api?t=caps&apikey=skdfiw7823sdkdsfjsfk
|
2015-09-18 00:06:34 +00:00
|
|
|
|
Returns a tuple with (succes or not, array with dicts [{"id": "5070", "name": "Anime"},
|
2014-09-01 15:57:52 +00:00
|
|
|
|
{"id": "5080", "name": "Documentary"}, {"id": "5020", "name": "Foreign"}...etc}], error message)
|
|
|
|
|
"""
|
|
|
|
|
return_categories = []
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2015-07-13 09:39:20 +00:00
|
|
|
|
api_key = self._check_auth()
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
|
|
|
|
params = {'t': 'caps'}
|
2015-07-13 09:39:20 +00:00
|
|
|
|
if isinstance(api_key, basestring):
|
|
|
|
|
params['apikey'] = api_key
|
2014-09-01 15:57:52 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
url = '%s/api?%s' % (self.url.strip('/'), '&'.join(['%s=%s' % (k, v) for k, v in params.items()]))
|
|
|
|
|
categories = self.get_url(url, timeout=10)
|
2015-07-13 09:39:20 +00:00
|
|
|
|
if not categories:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
logger.log(u'Error getting html for [%s]' % url, logger.DEBUG)
|
|
|
|
|
return False, return_categories, 'Error getting html for [%s]' % url
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2014-09-01 15:57:52 +00:00
|
|
|
|
xml_categories = helpers.parse_xml(categories)
|
|
|
|
|
if not xml_categories:
|
2015-06-19 16:47:52 +00:00
|
|
|
|
logger.log(u'Error parsing xml for [%s]' % self.name, logger.DEBUG)
|
|
|
|
|
return False, return_categories, 'Error parsing xml for [%s]' % self.name
|
|
|
|
|
|
2014-09-01 15:57:52 +00:00
|
|
|
|
try:
|
|
|
|
|
for category in xml_categories.iter('category'):
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if 'TV' == category.get('name'):
|
|
|
|
|
for subcat in category.findall('subcat'):
|
|
|
|
|
return_categories.append(subcat.attrib)
|
2014-09-01 15:57:52 +00:00
|
|
|
|
except:
|
2015-06-19 16:47:52 +00:00
|
|
|
|
logger.log(u'Error parsing result for [%s]' % self.name, logger.DEBUG)
|
|
|
|
|
return False, return_categories, 'Error parsing result for [%s]' % self.name
|
|
|
|
|
|
|
|
|
|
return True, return_categories, ''
|
|
|
|
|
|
|
|
|
|
def config_str(self):
|
|
|
|
|
return '%s|%s|%s|%s|%i|%s|%i|%i|%i' \
|
2015-07-13 09:39:20 +00:00
|
|
|
|
% (self.name or '', self.url or '', self.maybe_apikey() or '', self.cat_ids or '', self.enabled,
|
2015-06-19 16:47:52 +00:00
|
|
|
|
self.search_mode or '', self.search_fallback, self.enable_recentsearch, self.enable_backlog)
|
2014-09-01 15:57:52 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
def _season_strings(self, ep_obj):
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
search_params = []
|
|
|
|
|
base_params = {}
|
2014-07-15 02:00:53 +00:00
|
|
|
|
|
|
|
|
|
# season
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
ep_detail = None
|
2015-08-14 23:02:05 +00:00
|
|
|
|
if ep_obj.show.air_by_date or ep_obj.show.is_sports:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
airdate = str(ep_obj.airdate).split('-')[0]
|
|
|
|
|
base_params['season'] = airdate
|
|
|
|
|
base_params['q'] = airdate
|
|
|
|
|
if ep_obj.show.air_by_date:
|
|
|
|
|
ep_detail = '+"%s"' % airdate
|
2014-07-15 02:00:53 +00:00
|
|
|
|
elif ep_obj.show.is_anime:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
base_params['season'] = '%d' % ep_obj.scene_absolute_number
|
2014-07-15 02:00:53 +00:00
|
|
|
|
else:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
base_params['season'] = str((ep_obj.season, ep_obj.scene_season)[bool(ep_obj.show.is_scene)])
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
ep_detail = 'S%02d' % helpers.tryInt(base_params['season'], 1)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# id search
|
2015-09-18 00:06:34 +00:00
|
|
|
|
ids = helpers.mapIndexersToShow(ep_obj.show)
|
2016-07-02 15:06:50 +00:00
|
|
|
|
ids_fail = '6box' in self.name
|
|
|
|
|
if not ids_fail and ids[1]: # or ids[2]:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params = base_params.copy()
|
|
|
|
|
use_id = False
|
|
|
|
|
if ids[1] and self.supports_tvdbid():
|
|
|
|
|
params['tvdbid'] = ids[1]
|
|
|
|
|
use_id = True
|
|
|
|
|
if ids[2]:
|
|
|
|
|
params['rid'] = ids[2]
|
|
|
|
|
use_id = True
|
|
|
|
|
use_id and search_params.append(params)
|
2014-08-29 06:15:51 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# query search and exceptions
|
2014-08-29 06:15:51 +00:00
|
|
|
|
name_exceptions = list(
|
2015-06-19 16:47:52 +00:00
|
|
|
|
set([helpers.sanitizeSceneName(a) for a in
|
|
|
|
|
scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]]))
|
2016-07-02 15:06:50 +00:00
|
|
|
|
|
|
|
|
|
spacer = 'geek' in self.get_id() and ' ' or '.'
|
2014-08-29 06:15:51 +00:00
|
|
|
|
for cur_exception in name_exceptions:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params = base_params.copy()
|
2016-07-02 15:06:50 +00:00
|
|
|
|
cur_exception = cur_exception.replace('.', spacer)
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if 'q' in params:
|
2016-07-02 15:06:50 +00:00
|
|
|
|
params['q'] = '%s%s%s' % (cur_exception, spacer, params['q'])
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
search_params.append(params)
|
|
|
|
|
|
|
|
|
|
if ep_detail:
|
|
|
|
|
params = base_params.copy()
|
2016-07-02 15:06:50 +00:00
|
|
|
|
params['q'] = '%s%s%s' % (cur_exception, spacer, ep_detail)
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
'season' in params and params.pop('season')
|
|
|
|
|
'ep' in params and params.pop('ep')
|
|
|
|
|
search_params.append(params)
|
2014-05-04 03:16:26 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return [{'Season': search_params}]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
def _episode_strings(self, ep_obj):
|
|
|
|
|
|
|
|
|
|
search_params = []
|
|
|
|
|
base_params = {}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2014-04-30 13:49:50 +00:00
|
|
|
|
if not ep_obj:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return [base_params]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
ep_detail = None
|
2015-08-14 23:02:05 +00:00
|
|
|
|
if ep_obj.show.air_by_date or ep_obj.show.is_sports:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
airdate = str(ep_obj.airdate).split('-')
|
|
|
|
|
base_params['season'] = airdate[0]
|
|
|
|
|
if ep_obj.show.air_by_date:
|
|
|
|
|
base_params['ep'] = '/'.join(airdate[1:])
|
|
|
|
|
ep_detail = '+"%s.%s"' % (base_params['season'], '.'.join(airdate[1:]))
|
2015-08-14 23:02:05 +00:00
|
|
|
|
elif ep_obj.show.is_anime:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
base_params['ep'] = '%i' % (helpers.tryInt(ep_obj.scene_absolute_number) or
|
|
|
|
|
helpers.tryInt(ep_obj.scene_episode))
|
2016-07-02 15:06:50 +00:00
|
|
|
|
ep_detail = '%02d' % helpers.tryInt(base_params['ep'])
|
2014-03-10 05:18:05 +00:00
|
|
|
|
else:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
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]
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
ep_detail = sickbeard.config.naming_ep_type[2] % {
|
|
|
|
|
'seasonnumber': helpers.tryInt(base_params['season'], 1),
|
|
|
|
|
'episodenumber': helpers.tryInt(base_params['ep'], 1)}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# id search
|
2015-09-18 00:06:34 +00:00
|
|
|
|
ids = helpers.mapIndexersToShow(ep_obj.show)
|
2016-07-02 15:06:50 +00:00
|
|
|
|
ids_fail = '6box' in self.name
|
|
|
|
|
if not ids_fail and ids[1]: # or ids[2]:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params = base_params.copy()
|
|
|
|
|
use_id = False
|
|
|
|
|
if ids[1]:
|
|
|
|
|
if self.supports_tvdbid():
|
|
|
|
|
params['tvdbid'] = ids[1]
|
|
|
|
|
use_id = True
|
|
|
|
|
if ids[2]:
|
|
|
|
|
params['rid'] = ids[2]
|
|
|
|
|
use_id = True
|
|
|
|
|
use_id and search_params.append(params)
|
2014-08-29 06:15:51 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# query search and exceptions
|
2014-08-29 06:15:51 +00:00
|
|
|
|
name_exceptions = list(
|
2015-06-19 16:47:52 +00:00
|
|
|
|
set([helpers.sanitizeSceneName(a) for a in
|
|
|
|
|
scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]]))
|
2015-09-18 00:06:34 +00:00
|
|
|
|
|
2016-07-02 15:06:50 +00:00
|
|
|
|
spacer = 'geek' in self.get_id() and ' ' or '.'
|
2016-08-21 20:31:18 +00:00
|
|
|
|
if sickbeard.scene_exceptions.has_abs_episodes(ep_obj):
|
|
|
|
|
search_params.append({'q': '%s%s%s' % (ep_obj.show.name, spacer, base_params['ep'])})
|
2014-08-29 06:15:51 +00:00
|
|
|
|
for cur_exception in name_exceptions:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params = base_params.copy()
|
2016-07-02 15:06:50 +00:00
|
|
|
|
cur_exception = cur_exception.replace('.', spacer)
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params['q'] = cur_exception
|
|
|
|
|
search_params.append(params)
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
if ep_detail:
|
2015-09-18 00:06:34 +00:00
|
|
|
|
params = base_params.copy()
|
2016-07-02 15:06:50 +00:00
|
|
|
|
params['q'] = '%s%s%s' % (cur_exception, spacer, ep_detail)
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
'season' in params and params.pop('season')
|
|
|
|
|
'ep' in params and params.pop('ep')
|
2015-09-18 00:06:34 +00:00
|
|
|
|
search_params.append(params)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return [{'Episode': search_params}]
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
def supports_tvdbid(self):
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return self.get_id() not in ['sick_beard_index']
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
def _search_provider(self, search_params, **kwargs):
|
2014-05-26 06:29:22 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
api_key = self._check_auth()
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
base_params = {'t': 'tvsearch',
|
|
|
|
|
'maxage': sickbeard.USENET_RETENTION or 0,
|
|
|
|
|
'limit': 100,
|
|
|
|
|
'attrs': 'rageid',
|
|
|
|
|
'offset': 0}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-07-13 09:39:20 +00:00
|
|
|
|
if isinstance(api_key, basestring):
|
2015-09-18 00:06:34 +00:00
|
|
|
|
base_params['apikey'] = api_key
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2014-08-20 00:44:05 +00:00
|
|
|
|
results = []
|
2015-12-14 03:38:17 +00:00
|
|
|
|
total, cnt, search_url, exit_log = 0, len(results), '', False
|
2015-09-18 00:06:34 +00:00
|
|
|
|
|
|
|
|
|
for mode in search_params.keys():
|
|
|
|
|
for i, params in enumerate(search_params[mode]):
|
|
|
|
|
|
|
|
|
|
# category ids
|
|
|
|
|
cat = []
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
cat_sport = ['5060']
|
2016-07-02 15:06:50 +00:00
|
|
|
|
cat_anime = (['5070'], ['6070,7040'])['nzbs_org' == self.get_id()]
|
2015-09-18 00:06:34 +00:00
|
|
|
|
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.')
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
if self.show:
|
|
|
|
|
if self.show.is_sports:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
cat = cat_sport
|
2015-09-18 00:06:34 +00:00
|
|
|
|
elif self.show.is_anime:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
cat = cat_anime
|
2015-09-18 00:06:34 +00:00
|
|
|
|
else:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
cat = cat_sport + cat_anime
|
2014-09-07 07:48:09 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if self.cat_ids or len(cat):
|
|
|
|
|
base_params['cat'] = ','.join(sorted(set(self.cat_ids.split(',') + cat)))
|
2014-08-20 00:44:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
request_params = base_params.copy()
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
if 'q' in params and not (any(x in params for x in ['season', 'ep'])):
|
|
|
|
|
request_params['t'] = 'search'
|
2015-09-18 00:06:34 +00:00
|
|
|
|
request_params.update(params)
|
2014-09-07 07:48:09 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# workaround a strange glitch
|
|
|
|
|
if sum(ord(i) for i in self.get_id()) in [383] and 5 == 14 - request_params['maxage']:
|
|
|
|
|
request_params['maxage'] += 1
|
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
offset = 0
|
|
|
|
|
batch_count = not 0
|
2014-08-20 00:44:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
# hardcoded to stop after a max of 4 hits (400 items) per query
|
|
|
|
|
while (offset <= total) and (offset < (200, 400)[self.supports_tvdbid()]) and batch_count:
|
|
|
|
|
cnt = len(results)
|
2014-08-20 00:44:05 +00:00
|
|
|
|
|
2016-02-26 01:07:39 +00:00
|
|
|
|
data = self.cache.getRSSFeed('%sapi' % self.url, params=request_params)
|
2016-07-25 16:36:06 +00:00
|
|
|
|
i and time.sleep(2.1)
|
2014-09-23 14:15:13 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if not data or not self.check_auth_from_data(data):
|
|
|
|
|
break
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
for item in data.entries:
|
2015-06-19 16:47:52 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
title, url = self._title_and_url(item)
|
|
|
|
|
if title and url:
|
|
|
|
|
results.append(item)
|
|
|
|
|
else:
|
|
|
|
|
logger.log(u'The data returned from %s is incomplete, this result is unusable' % self.name,
|
|
|
|
|
logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
# get total and offset attribs
|
|
|
|
|
try:
|
|
|
|
|
if 0 == total:
|
|
|
|
|
total = int(data.feed.newznab_response['total'] or 0)
|
|
|
|
|
hits = (total / 100 + int(0 < (total % 100)))
|
|
|
|
|
hits += int(0 == hits)
|
|
|
|
|
offset = int(data.feed.newznab_response['offset'] or 0)
|
|
|
|
|
except AttributeError:
|
|
|
|
|
break
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-12-14 03:38:17 +00:00
|
|
|
|
# No items found, prevent from doing another search
|
|
|
|
|
if 0 == total:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
# Cache mode, prevent from doing another search
|
|
|
|
|
if 'Cache' == mode:
|
|
|
|
|
exit_log = True
|
2015-09-18 00:06:34 +00:00
|
|
|
|
break
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if offset != request_params['offset']:
|
2016-02-26 01:07:39 +00:00
|
|
|
|
logger.log('Ask your newznab provider to fix their newznab responses')
|
2015-09-18 00:06:34 +00:00
|
|
|
|
break
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
request_params['offset'] += request_params['limit']
|
|
|
|
|
if total <= request_params['offset']:
|
2015-12-14 03:38:17 +00:00
|
|
|
|
exit_log = True
|
2016-02-26 01:07:39 +00:00
|
|
|
|
logger.log('%s item%s found for episode matching' % (total, helpers.maybe_plural(total)),
|
2015-09-18 00:06:34 +00:00
|
|
|
|
logger.DEBUG)
|
|
|
|
|
break
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
# there are more items available than the amount given in one call, grab some more
|
|
|
|
|
items = total - request_params['offset']
|
|
|
|
|
logger.log('%s more item%s to fetch from a batch of up to %s items.'
|
|
|
|
|
% (items, helpers.maybe_plural(items), request_params['limit']), logger.DEBUG)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2016-02-26 01:07:39 +00:00
|
|
|
|
batch_count = self._log_result(results, mode, cnt, data.rq_response['url'])
|
2015-12-14 03:38:17 +00:00
|
|
|
|
|
|
|
|
|
if exit_log:
|
2016-02-26 01:07:39 +00:00
|
|
|
|
self._log_result(results, mode, cnt, data and data.rq_response['url'] or '%sapi' % self.url)
|
2015-12-14 03:38:17 +00:00
|
|
|
|
exit_log = False
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if 'tvdbid' in request_params and len(results):
|
|
|
|
|
break
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return results
|
2014-05-26 06:29:22 +00:00
|
|
|
|
|
2015-12-14 03:38:17 +00:00
|
|
|
|
def _log_result(self, results, mode, cnt, url):
|
|
|
|
|
count = len(results) - cnt
|
|
|
|
|
if count:
|
|
|
|
|
self._log_search(mode, count, url)
|
|
|
|
|
return count
|
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
class NewznabCache(tvcache.TVCache):
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
def __init__(self, provider):
|
|
|
|
|
tvcache.TVCache.__init__(self, provider)
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
self.update_freq = 5 # cache update frequency
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
2014-05-11 12:49:07 +00:00
|
|
|
|
def updateCache(self):
|
2014-05-18 15:33:31 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
result = []
|
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
if 4489 != sickbeard.RECENTSEARCH_FREQUENCY or self.should_update():
|
2015-07-13 09:39:20 +00:00
|
|
|
|
try:
|
|
|
|
|
self._checkAuth()
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
items = self.provider.cache_data()
|
2015-07-13 09:39:20 +00:00
|
|
|
|
except Exception:
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
items = None
|
2014-05-11 12:49:07 +00:00
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
if items:
|
|
|
|
|
self._clearCache()
|
2014-08-30 08:47:00 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# parse data
|
2014-07-15 02:00:53 +00:00
|
|
|
|
cl = []
|
2014-05-11 12:49:07 +00:00
|
|
|
|
for item in items:
|
|
|
|
|
ci = self._parseItem(item)
|
|
|
|
|
if ci is not None:
|
2014-07-15 02:00:53 +00:00
|
|
|
|
cl.append(ci)
|
2014-07-02 18:51:14 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if 0 < len(cl):
|
2015-07-13 09:39:20 +00:00
|
|
|
|
my_db = self.get_db()
|
2015-06-19 16:47:52 +00:00
|
|
|
|
my_db.mass_action(cl)
|
2014-05-11 12:49:07 +00:00
|
|
|
|
|
Change validate and improve specific Torrent provider connections, IPT, KAT, SCC, TPB, TB, TD, TT.
Change refactor cache for torrent providers to reduce code.
Change improve search category selection BMTV, FSH, FF, TB.
Change identify more SD release qualities.
Change update SpeedCD, MoreThan, TVChaosuk.
Add torrent provider HD4Free.
Remove torrent provider BitSoup.
Change only create threads for providers needing a recent search instead of for all enabled.
Add 4489 as experimental value to "Recent search frequency" to use provider freqs instead of fixed width for all.
Fix searching nzb season packs.
Change remove some logging cruft.
2016-03-24 18:24:14 +00:00
|
|
|
|
# set updated as time the attempt to fetch data is
|
|
|
|
|
self.setLastUpdate()
|
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
|
return result
|
2014-05-11 12:49:07 +00:00
|
|
|
|
|
|
|
|
|
# overwrite method with that parses the rageid from the newznab feed
|
2015-06-19 16:47:52 +00:00
|
|
|
|
def _parseItem(self, *item):
|
|
|
|
|
|
|
|
|
|
title = item[0].title
|
|
|
|
|
url = item[0].link
|
2014-05-11 12:49:07 +00:00
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
attrs = item[0].newznab_attr
|
2014-07-15 02:00:53 +00:00
|
|
|
|
if not isinstance(attrs, list):
|
2015-06-19 16:47:52 +00:00
|
|
|
|
attrs = [item[0].newznab_attr]
|
2014-07-15 02:00:53 +00:00
|
|
|
|
|
|
|
|
|
tvrageid = 0
|
|
|
|
|
for attr in attrs:
|
2015-06-19 16:47:52 +00:00
|
|
|
|
if 'tvrageid' == attr['name']:
|
2014-07-15 02:00:53 +00:00
|
|
|
|
tvrageid = int(attr['value'])
|
|
|
|
|
break
|
|
|
|
|
|
2014-05-11 12:49:07 +00:00
|
|
|
|
self._checkItemAuth(title, url)
|
|
|
|
|
|
|
|
|
|
if not title or not url:
|
2015-06-19 16:47:52 +00:00
|
|
|
|
logger.log(u'The data returned from the %s feed is incomplete, this result is unusable'
|
|
|
|
|
% self.provider.name, logger.DEBUG)
|
2014-05-11 12:49:07 +00:00
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
url = self._translateLinkURL(url)
|
|
|
|
|
|
2015-06-19 16:47:52 +00:00
|
|
|
|
logger.log(u'Attempting to add item from RSS to cache: ' + title, logger.DEBUG)
|
2015-07-13 09:39:20 +00:00
|
|
|
|
return self.add_cache_entry(title, url, indexer_id=tvrageid)
|