Added tvdbid and tvrageid support to BTN provider

This commit is contained in:
echel0n 2014-03-30 17:17:24 -07:00
parent 4caf2441d6
commit 684f1fd671

View file

@ -137,7 +137,7 @@ class BTNProvider(generic.TorrentProvider):
try:
parsedJSON = server.getTorrents(apikey, params, int(results_per_page), int(offset))
except jsonrpclib.jsonrpc.ProtocolError, error:
except jsonrpclib.ProtocolError, error:
logger.log(u"JSON-RPC protocol error while accessing " + self.name + ": " + ex(error), logger.ERROR)
parsedJSON = {'api-error': ex(error)}
return parsedJSON
@ -193,7 +193,7 @@ class BTNProvider(generic.TorrentProvider):
def _get_season_search_strings(self, show, season, wantedEp, searchSeason=False):
if not show:
return [{}]
return []
search_params = []
@ -202,7 +202,13 @@ class BTNProvider(generic.TorrentProvider):
current_params = {}
# Search by name if we don't have indexer ID
if show.indexer is 1:
current_params['tvdb'] = show.indexerid
elif show.indexer is 2:
current_params['tvrage'] = show.indexerid
else:
# Search by name if we don't have tvdb or tvrage id
current_params['series'] = sanitizeSceneName(name)
if searchSeason:
@ -225,7 +231,6 @@ class BTNProvider(generic.TorrentProvider):
partial_season_params['name'] = 'S%02d' % int(season)
search_params.append(partial_season_params)
else:
search_params.append(current_params)
@ -374,5 +379,4 @@ class BTNCache(tvcache.TVCache):
def _checkAuth(self, data):
return self.provider._checkAuthFromData(data)
provider = BTNProvider()