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

Fixes for RSS searches

This commit is contained in:
echel0n 2014-04-25 17:03:24 -07:00
parent 0e82c5f573
commit a455bcb7c6
3 changed files with 17 additions and 11 deletions

View File

@ -28,6 +28,8 @@ import copy
import itertools
import operator
import collections
import urlparse
from lib.feedparser import feedparser
import sickbeard
@ -117,6 +119,19 @@ class GenericProvider:
return data
def getRSSFeed(self, url):
parsed = list(urlparse.urlparse(url))
parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one
f = feedparser.parse(url)
data = f.entries
if not data:
logger.log(u"Error loading " + self.name + " URL: " + ex(e), logger.ERROR)
return None
return data
def downloadResult(self, result):
"""
Save the result to disk.

View File

@ -37,7 +37,6 @@ from lib.feedparser import feedparser
class TorrentRssProvider(generic.TorrentProvider):
def __init__(self, name, url):
generic.TorrentProvider.__init__(self, name)
self.cache = TorrentRssCache(self)
self.url = re.sub('\/$', '', url)
@ -147,21 +146,13 @@ class TorrentRssProvider(generic.TorrentProvider):
class TorrentRssCache(tvcache.TVCache):
def __init__(self, provider):
tvcache.TVCache.__init__(self, provider)
self.minTime = 15
def _getRSSData(self):
url = self.provider.url
parsed = list(urlparse.urlparse(url))
parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one
logger.log(u"TorrentRssCache cache update URL: " + self.provider.url, logger.DEBUG)
try:
data = feedparser.parse(url)
return data.entries
except Exception, e:
logger.log(u"Error loading " + self.provider + " URL: " + ex(e), logger.ERROR)
return self.provider.getRSSFeed(url)
def _parseItem(self, item):

View File

@ -42,7 +42,7 @@ class WombleCache(tvcache.TVCache):
def _getRSSData(self):
url = self.provider.url + 'rss/?sec=TV-x264&fr=false'
logger.log(u"Womble's Index cache update URL: " + url, logger.DEBUG)
data = self.provider.getURL(url)
data = self.provider.getRSSFeed(url)
return data
def _checkAuth(self, data):