1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Fixed issues for custom RSS torrent providers

This commit is contained in:
echel0n 2014-05-20 20:22:48 -07:00
parent 37df671ae6
commit 8141d8a170
3 changed files with 33 additions and 12 deletions

View File

@ -114,7 +114,8 @@ def makeNewznabProvider(configString):
newznab = sys.modules['sickbeard.providers.newznab']
newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs, search_mode=search_mode, search_fallback=search_fallback)
newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs, search_mode=search_mode,
search_fallback=search_fallback)
newProvider.enabled = enabled == '1'
return newProvider
@ -122,6 +123,15 @@ def makeNewznabProvider(configString):
def getTorrentRssProviderList(data):
providerList = filter(lambda x: x, [makeTorrentRssProvider(x) for x in data.split('!!!')])
seen_values = set()
providerListDeduped = []
for d in providerList:
value = d.name
if value not in seen_values:
providerListDeduped.append(d)
seen_values.add(value)
return filter(lambda x: x, providerList)
@ -129,11 +139,22 @@ def makeTorrentRssProvider(configString):
if not configString:
return None
search_mode = 'eponly'
search_fallback = 0
backlog_only = 0
try:
name, url, enabled, search_mode, search_fallback, backlog_only = configString.split('|')
except ValueError:
try:
name, url, enabled = configString.split('|')
except ValueError:
logger.log(u"Skipping RSS Torrent provider string: '" + configString + "', incorrect format", logger.ERROR)
return None
torrentRss = sys.modules['sickbeard.providers.rsstorrent']
newProvider = torrentRss.TorrentRssProvider(name, url)
newProvider = torrentRss.TorrentRssProvider(name, url, search_mode, search_fallback, backlog_only)
newProvider.enabled = enabled == '1'
return newProvider

View File

@ -53,11 +53,6 @@ class NewznabProvider(generic.NZBProvider):
self.search_mode = search_mode
self.search_fallback = search_fallback
if self.search_fallback == '0':
self.search_fallback = False
else:
self.search_fallback = True
# a 0 in the key spot indicates that no key is needed
if self.key == '0':
self.needs_auth = False

View File

@ -35,15 +35,20 @@ from lib.requests import exceptions
from lib.bencode import bdecode
class TorrentRssProvider(generic.TorrentProvider):
def __init__(self, name, url):
def __init__(self, name, url, search_mode='eponly', search_fallback=False, backlog_only=False):
generic.TorrentProvider.__init__(self, name)
self.cache = TorrentRssCache(self)
self.url = re.sub('\/$', '', url)
#self.url = re.sub('\/$', '', url)
self.url = url
self.enabled = True
self.supportsBacklog = False
self.search_mode = search_mode
self.search_fallback = search_fallback
self.backlog_only = backlog_only
def configStr(self):
return self.name + '|' + self.url + '|' + str(int(self.enabled))
return self.name + '|' + self.url + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(int(self.backlog_only))
def imageName(self):
if ek.ek(os.path.isfile, ek.ek(os.path.join, sickbeard.PROG_DIR, 'data', 'images', 'providers', self.getID() + '.png')):
@ -164,5 +169,5 @@ class TorrentRssCache(tvcache.TVCache):
logger.log(u"The XML returned from the 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)
logger.log(u"Attempting to add item to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)