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:
parent
0e82c5f573
commit
a455bcb7c6
@ -28,6 +28,8 @@ import copy
|
|||||||
import itertools
|
import itertools
|
||||||
import operator
|
import operator
|
||||||
import collections
|
import collections
|
||||||
|
import urlparse
|
||||||
|
from lib.feedparser import feedparser
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
@ -117,6 +119,19 @@ class GenericProvider:
|
|||||||
|
|
||||||
return data
|
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):
|
def downloadResult(self, result):
|
||||||
"""
|
"""
|
||||||
Save the result to disk.
|
Save the result to disk.
|
||||||
|
@ -37,7 +37,6 @@ from lib.feedparser import feedparser
|
|||||||
|
|
||||||
class TorrentRssProvider(generic.TorrentProvider):
|
class TorrentRssProvider(generic.TorrentProvider):
|
||||||
def __init__(self, name, url):
|
def __init__(self, name, url):
|
||||||
|
|
||||||
generic.TorrentProvider.__init__(self, name)
|
generic.TorrentProvider.__init__(self, name)
|
||||||
self.cache = TorrentRssCache(self)
|
self.cache = TorrentRssCache(self)
|
||||||
self.url = re.sub('\/$', '', url)
|
self.url = re.sub('\/$', '', url)
|
||||||
@ -147,21 +146,13 @@ class TorrentRssProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
class TorrentRssCache(tvcache.TVCache):
|
class TorrentRssCache(tvcache.TVCache):
|
||||||
def __init__(self, provider):
|
def __init__(self, provider):
|
||||||
|
|
||||||
tvcache.TVCache.__init__(self, provider)
|
tvcache.TVCache.__init__(self, provider)
|
||||||
self.minTime = 15
|
self.minTime = 15
|
||||||
|
|
||||||
def _getRSSData(self):
|
def _getRSSData(self):
|
||||||
url = self.provider.url
|
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)
|
logger.log(u"TorrentRssCache cache update URL: " + self.provider.url, logger.DEBUG)
|
||||||
try:
|
return self.provider.getRSSFeed(url)
|
||||||
data = feedparser.parse(url)
|
|
||||||
return data.entries
|
|
||||||
except Exception, e:
|
|
||||||
logger.log(u"Error loading " + self.provider + " URL: " + ex(e), logger.ERROR)
|
|
||||||
|
|
||||||
def _parseItem(self, item):
|
def _parseItem(self, item):
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class WombleCache(tvcache.TVCache):
|
|||||||
def _getRSSData(self):
|
def _getRSSData(self):
|
||||||
url = self.provider.url + 'rss/?sec=TV-x264&fr=false'
|
url = self.provider.url + 'rss/?sec=TV-x264&fr=false'
|
||||||
logger.log(u"Womble's Index cache update URL: " + url, logger.DEBUG)
|
logger.log(u"Womble's Index cache update URL: " + url, logger.DEBUG)
|
||||||
data = self.provider.getURL(url)
|
data = self.provider.getRSSFeed(url)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _checkAuth(self, data):
|
def _checkAuth(self, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user