1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-16 06:15:09 -05:00

Fixed issues with TorrentDay provider.

Fixed issues with newznab providers.
This commit is contained in:
echel0n 2014-12-11 14:06:23 -08:00
parent 2cd72ad4e8
commit d88dccd5ab
3 changed files with 16 additions and 15 deletions

View File

@ -238,7 +238,7 @@ class GenericProvider:
title = item.get('title') title = item.get('title')
if title: if title:
title = title.replace(' ', '.') title = u'' + title.replace(' ', '.')
url = item.get('link') url = item.get('link')
if url: if url:

View File

@ -244,9 +244,12 @@ class NewznabProvider(generic.NZBProvider):
except:return self._checkAuth() except:return self._checkAuth()
try: try:
err_code = int(data['feed']['error']['code'] or 0) err_code = int(data['feed']['error']['code'])
err_desc = data['feed']['error']['description'] err_desc = data['feed']['error']['description']
except:return True if not err_code or err_desc:
raise
except:
return True
if err_code == 100: if err_code == 100:
raise AuthException("Your API key for " + self.name + " is incorrect, check your config.") raise AuthException("Your API key for " + self.name + " is incorrect, check your config.")
@ -430,13 +433,7 @@ class NewznabCache(tvcache.TVCache):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)
def _parseItem(self, item): def _parseItem(self, item):
(title, url) = self._get_title_and_url(item) title, url = self._get_title_and_url(item)
tvrageid = 0
for attr in item.get('newznab_attr', []):
if attr['name'] == 'tvrageid':
tvrageid = int(attr['value'] or 0)
break
self._checkItemAuth(title, url) self._checkItemAuth(title, url)
@ -446,7 +443,11 @@ class NewznabCache(tvcache.TVCache):
logger.DEBUG) logger.DEBUG)
return None return None
url = self._translateLinkURL(url) tvrageid = 0
for attr in item['newznab_attr'] if isinstance(item['newznab_attr'], list) else [item['newznab_attr']]:
if attr['name'] == 'tvrageid':
tvrageid = int(attr['value'] or 0)
break
logger.log(u"Attempting to add item from RSS to cache: " + title, logger.DEBUG) logger.log(u"Attempting to add item from RSS to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url, indexer_id=tvrageid) return self._addCacheEntry(title, url, indexer_id=tvrageid)

View File

@ -35,10 +35,10 @@ from sickbeard.helpers import sanitizeSceneName
class TorrentDayProvider(generic.TorrentProvider): class TorrentDayProvider(generic.TorrentProvider):
urls = {'base_url': 'http://www.torrentday.com', urls = {'base_url': 'http://www.td.af',
'login': 'http://www.torrentday.com/torrents/', 'login': 'http://www.td.af/torrents/',
'search': 'http://www.torrentday.com/V3/API/API.php', 'search': 'http://www.td.af/V3/API/API.php',
'download': 'http://www.torrentday.com/download.php/%s/%s' 'download': 'http://www.td.af/download.php/%s/%s'
} }
def __init__(self): def __init__(self):