mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 13:43:37 +00:00
0ead7771de
Add the improved error handling to torrent providers. Change cache_db to always include db upgrade statements when running SG for the first time. Change split newznab limit logic into a reusable function, hit_limit_update() and use in BTN prov. Change tweak CSS to make things a little neater with button spacings. Add the actual time when current limit will expire to the UI. Change instead of terminology "errors", use "failures". Change improve BTN error handling. Change ensure provider name is output to log at times where it wasn't. Change ensure failed request URLs and POST params are output to log. Add time of last failure + type to should_skip log message. Change code DRY and simplification for improved readability. Change occurrences of "error" to "fail" for consistency. Add tmr limit handling to omg and change log_failure_url level to warning. Change log the failed URL when an API hit limit is reached. Change "hit" to the more universally generic "tmr" - Too Many Requests. Change Db columns containing "hit_" are renamed "tmr_"
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
# coding=utf-8
|
|
#
|
|
# This file is part of SickGear.
|
|
#
|
|
|
|
import feedparser
|
|
|
|
from sickbeard import logger
|
|
from sickbeard.exceptions import ex
|
|
|
|
|
|
class RSSFeeds:
|
|
|
|
def __init__(self, provider=None):
|
|
self.provider = provider
|
|
|
|
def get_feed(self, url, **kwargs):
|
|
|
|
if self.provider and self.provider.check_auth_cookie():
|
|
response = self.provider.get_url(url, **kwargs)
|
|
if not self.provider.should_skip() and response:
|
|
try:
|
|
data = feedparser.parse(response)
|
|
data['rq_response'] = self.provider.session.response
|
|
if data and 'entries' in data:
|
|
return data
|
|
|
|
if data and 'error' in data.feed:
|
|
err_code = data.feed['error']['code']
|
|
err_desc = data.feed['error']['description']
|
|
logger.log(u'RSS error:[%s] code:[%s]' % (err_desc, err_code), logger.DEBUG)
|
|
else:
|
|
logger.log(u'RSS error loading url: ' + url, logger.DEBUG)
|
|
|
|
except Exception as e:
|
|
logger.log(u'RSS error: ' + ex(e), logger.DEBUG)
|