1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

Fix for debug logging on console.

Fix for RSS feeds for all providers.
This commit is contained in:
echel0n 2014-04-28 03:57:30 -07:00
parent 5e38813a73
commit 99bbd0649c
17 changed files with 45 additions and 71 deletions

View File

@ -98,7 +98,7 @@ class SBRotatingLogHandler(object):
# define a Handler which writes INFO messages or higher to the sys.stderr # define a Handler which writes INFO messages or higher to the sys.stderr
console = logging.StreamHandler() console = logging.StreamHandler()
console.setLevel(logging.DEBUG) console.setLevel(logging.INFO)
# set a format which is simpler for console use # set a format which is simpler for console use
console.setFormatter(DispatchingFormatter( console.setFormatter(DispatchingFormatter(

View File

@ -211,4 +211,25 @@ sports_regexs = [
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+ (?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$ (?P<release_group>.*?)$
'''), '''),
('sports_parts_without_event',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
(?P<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<air_day>\d{1,2}[a-zA-Z]{2})[. _-]+
(?P<air_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$
'''),
('sports_bare',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
(?P<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$
'''),
] ]

View File

@ -357,9 +357,7 @@ class BTNCache(tvcache.TVCache):
logger.WARNING) logger.WARNING)
seconds_since_last_update = 86400 seconds_since_last_update = 86400
data = self.provider._doSearch(search_params=None, age=seconds_since_last_update) return self.provider._doSearch(search_params=None, age=seconds_since_last_update)
return data
def _parseItem(self, item): def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item) (title, url) = self.provider._get_title_and_url(item)

View File

@ -126,8 +126,7 @@ class DTTCache(tvcache.TVCache):
url = self.provider.url + 'rss/allshows?' + urllib.urlencode(params) url = self.provider.url + 'rss/allshows?' + urllib.urlencode(params)
logger.log(u"DTT cache update URL: " + url, logger.DEBUG) logger.log(u"DTT cache update URL: " + url, logger.DEBUG)
data = self.provider.getRSSFeed(url) return self.provider.getRSSFeed(url)
return data
def _parseItem(self, item): def _parseItem(self, item):
title, url = self.provider._get_title_and_url(item) title, url = self.provider._get_title_and_url(item)

View File

@ -118,7 +118,6 @@ class EZRSSProvider(generic.TorrentProvider):
data = self.getRSSFeed(search_url) data = self.getRSSFeed(search_url)
if not data: if not data:
logger.log(u"No data returned from " + search_url, logger.ERROR)
return [] return []
items = data.entries items = data.entries
@ -172,13 +171,7 @@ class EZRSSCache(tvcache.TVCache):
rss_url = self.provider.url + 'feed/' rss_url = self.provider.url + 'feed/'
logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG)
data = self.provider.getRSSFeed(rss_url) return self.provider.getRSSFeed(rss_url)
if not data:
logger.log(u"No data returned from " + rss_url, logger.ERROR)
return None
return data
def _parseItem(self, item): def _parseItem(self, item):

View File

@ -44,7 +44,6 @@ from lib.hachoir_parser import createParser
from sickbeard.name_parser.parser import NameParser, InvalidNameException from sickbeard.name_parser.parser import NameParser, InvalidNameException
from sickbeard.common import Quality, Overview from sickbeard.common import Quality, Overview
class GenericProvider: class GenericProvider:
NZB = "nzb" NZB = "nzb"
TORRENT = "torrent" TORRENT = "torrent"
@ -137,6 +136,12 @@ class GenericProvider:
if not f: if not f:
logger.log(u"Error loading " + self.name + " URL: " + url, logger.ERROR) logger.log(u"Error loading " + self.name + " URL: " + url, logger.ERROR)
return None return None
elif 'error' in f.feed:
logger.log(u"Newznab ERROR:[%s] CODE:[%s]" % (f.feed['error']['description'], f.feed['error']['code']), logger.DEBUG)
return None
elif not f.entries:
logger.log(u"Error loading RSS feed items for " + self.name + " using URL: " + url, logger.ERROR)
return None
return f return f

View File

@ -323,9 +323,7 @@ class NewzbinProvider(generic.NZBProvider):
url = self.url + "search/?%s" % urllib.urlencode(params) url = self.url + "search/?%s" % urllib.urlencode(params)
logger.log("Newzbin search URL: " + url, logger.DEBUG) logger.log("Newzbin search URL: " + url, logger.DEBUG)
data = self.getRSSFeed(url) return self.getRSSFeed(url)
return data
def _checkAuth(self): def _checkAuth(self):
if sickbeard.NEWZBIN_USERNAME in (None, "") or sickbeard.NEWZBIN_PASSWORD in (None, ""): if sickbeard.NEWZBIN_USERNAME in (None, "") or sickbeard.NEWZBIN_PASSWORD in (None, ""):
@ -342,9 +340,7 @@ class NewzbinCache(tvcache.TVCache):
def _getRSSData(self): def _getRSSData(self):
data = self.provider._getRSSData() return self.provider._getRSSData()
return data
def _parseItem(self, item): def _parseItem(self, item):

View File

@ -166,19 +166,9 @@ class NewznabProvider(generic.NZBProvider):
if data is None: if data is None:
return self._checkAuth() return self._checkAuth()
if len(data.feed) > 0: if 'error' in data.feed:
if 'error' in data.feed: logger.log(u"Newznab ERROR:[%s] CODE:[%s]" % (data.feed['error']['description'], data.feed['error']['code']), logger.DEBUG)
if data.feed.error == 100: raise AuthException("%s" % data.feed['error']['description'])
raise AuthException("Your API key for " + self.name + " is incorrect, check your config.")
elif data.feed.error == 101:
raise AuthException("Your account on " + self.name + " has been suspended, contact the administrator.")
elif data.feed.error == 102:
raise AuthException(
"Your account isn't allowed to use the API on " + self.name + ", contact the administrator")
else:
logger.log(u"Unknown error given from " + self.name + ": " + data.feed.title,
logger.ERROR)
return False
return True return True
@ -206,9 +196,7 @@ class NewznabProvider(generic.NZBProvider):
logger.log(u"Search url: " + search_url, logger.DEBUG) logger.log(u"Search url: " + search_url, logger.DEBUG)
data = self.getRSSFeed(search_url) data = self.getRSSFeed(search_url)
if not data: if not data:
logger.log(u"No data returned from " + search_url, logger.ERROR)
return [] return []
if self._checkAuthFromData(data): if self._checkAuthFromData(data):
@ -279,13 +267,7 @@ class NewznabCache(tvcache.TVCache):
logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG)
data = self.provider.getRSSFeed(rss_url) return self.provider.getRSSFeed(rss_url)
if not data:
logger.log(u"No data returned from " + rss_url, logger.ERROR)
return None
return data
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -133,9 +133,7 @@ class NyaaCache(tvcache.TVCache):
logger.log(u"NyaaTorrents cache update URL: " + url, logger.DEBUG) logger.log(u"NyaaTorrents cache update URL: " + url, logger.DEBUG)
data = self.provider.getRSSFeed(url) return self.provider.getRSSFeed(url)
return data
def _parseItem(self, item): def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item) (title, url) = self.provider._get_title_and_url(item)

View File

@ -151,9 +151,7 @@ class NZBsCache(tvcache.TVCache):
logger.log(u"NZBs cache update URL: " + url, logger.DEBUG) logger.log(u"NZBs cache update URL: " + url, logger.DEBUG)
data = self.provider.getURL(url) return self.provider.getURL(url)
return data
def _checkItemAuth(self, title, url): def _checkItemAuth(self, title, url):
if "&i=" not in url and "&h=" not in url: if "&i=" not in url and "&h=" not in url:

View File

@ -107,8 +107,7 @@ class NZBsRUSCache(tvcache.TVCache):
url += urllib.urlencode(urlArgs) url += urllib.urlencode(urlArgs)
logger.log(u"NZBs'R'US cache update URL: " + url, logger.DEBUG) logger.log(u"NZBs'R'US cache update URL: " + url, logger.DEBUG)
data = self.provider.getRSSFeed(url) return self.provider.getRSSFeed(url)
return data
def _checkAuth(self, data): def _checkAuth(self, data):
return data != 'Invalid Link' return data != 'Invalid Link'

View File

@ -164,13 +164,7 @@ class OmgwtfnzbsCache(tvcache.TVCache):
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
data = self.provider.getRSSFeed(rss_url) return self.provider.getRSSFeed(rss_url)
if not data:
logger.log(u"No data returned from " + rss_url, logger.ERROR)
return None
return data
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -82,7 +82,6 @@ class TorrentRssProvider(generic.TorrentProvider):
try: try:
data = self.cache._getRSSData() data = self.cache._getRSSData()
if not data: if not data:
return (False, 'No data returned from url: ' + self.url) return (False, 'No data returned from url: ' + self.url)

View File

@ -122,7 +122,6 @@ class ThePirateBayProvider(generic.TorrentProvider):
fileURL = self.proxy._buildURL(self.url + 'ajax_details_filelist.php?id=' + str(torrent_id)) fileURL = self.proxy._buildURL(self.url + 'ajax_details_filelist.php?id=' + str(torrent_id))
data = self.getURL(fileURL) data = self.getURL(fileURL)
if not data: if not data:
return None return None

View File

@ -84,13 +84,7 @@ class TvTorrentsCache(tvcache.TVCache):
rss_url = self.provider.url + 'RssServlet?digest=' + sickbeard.TVTORRENTS_DIGEST + '&hash=' + sickbeard.TVTORRENTS_HASH + '&fname=true&exclude=(' + ignore_regex + ')' rss_url = self.provider.url + 'RssServlet?digest=' + sickbeard.TVTORRENTS_DIGEST + '&hash=' + sickbeard.TVTORRENTS_HASH + '&fname=true&exclude=(' + ignore_regex + ')'
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
data = self.provider.getRSSFeed(rss_url) return self.provider.getRSSFeed(rss_url)
if not data:
logger.log(u"No data returned from " + rss_url, logger.ERROR)
return None
return data
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -42,8 +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.getRSSFeed(url) return self.provider.getRSSFeed(url)
return data
def _checkAuth(self, data): def _checkAuth(self, data):
return data != 'Invalid Link' return data != 'Invalid Link'

View File

@ -56,8 +56,8 @@ class XEMBasicTests(test.SickbeardTestDBCase):
ep_date_formated = ep.airdate.strftime('%b') ep_date_formated = ep.airdate.strftime('%b')
show_name = 'UFC' show_name = None
if show_name.lower() in sickbeard.showList: if show_name:
print 'good' print 'good'
else: else:
print 'bad' print 'bad'