1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 23:05:11 -05:00

Remove unnecessary code from nyaatorrents provider and PEP8

This commit is contained in:
Adam 2014-07-31 17:45:51 +08:00
parent ad39ac8772
commit 4728e19edf

View File

@ -28,7 +28,6 @@ from sickbeard.common import Quality
from sickbeard import tvcache from sickbeard import tvcache
from sickbeard import show_name_helpers from sickbeard import show_name_helpers
REMOTE_DBG = False
class NyaaProvider(generic.TorrentProvider): class NyaaProvider(generic.TorrentProvider):
def __init__(self): def __init__(self):
@ -70,7 +69,8 @@ class NyaaProvider(generic.TorrentProvider):
logger.log(u"" + str(self.show.name) + " is not an anime skiping " + str(self.name)) logger.log(u"" + str(self.show.name) + " is not an anime skiping " + str(self.name))
return [] return []
params = {"term": search_string.encode('utf-8'), params = {
"term": search_string.encode('utf-8'),
"cats": '1_37', # Limit to English-translated Anime (for now) "cats": '1_37', # Limit to English-translated Anime (for now)
"sort": '2', # Sort Descending By Seeders "sort": '2', # Sort Descending By Seeders
} }
@ -118,6 +118,7 @@ class NyaaProvider(generic.TorrentProvider):
def seedRatio(self): def seedRatio(self):
return self.ratio return self.ratio
class NyaaCache(tvcache.TVCache): class NyaaCache(tvcache.TVCache):
def __init__(self, provider): def __init__(self, provider):
tvcache.TVCache.__init__(self, provider) tvcache.TVCache.__init__(self, provider)
@ -128,7 +129,8 @@ class NyaaCache(tvcache.TVCache):
def _getRSSData(self): def _getRSSData(self):
params = { params = {
"page": 'rss', # Use RSS page "page": 'rss', # Use RSS page
"order": '1' #Sort Descending By Date "order": '1', # Sort Descending By Date
"cats": '1_37', # Limit to English-translated Anime (for now)
} }
url = self.provider.url + '?' + urllib.urlencode(params) url = self.provider.url + '?' + urllib.urlencode(params)
@ -137,17 +139,5 @@ class NyaaCache(tvcache.TVCache):
return self.getRSSFeed(url) return self.getRSSFeed(url)
def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item)
if not title or not url:
logger.log(u"The XML returned from the NyaaTorrents RSS feed is incomplete, this result is unusable",
logger.ERROR)
return None
logger.log(u"RSS Feed provider: [" + self.provider.name + "] Attempting to add item to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)
provider = NyaaProvider() provider = NyaaProvider()