mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fixed another issue in showUpdater.
This commit is contained in:
parent
e19e0e8d1c
commit
fac97e5f5a
3 changed files with 24 additions and 6 deletions
|
@ -366,10 +366,20 @@ class TVRage:
|
||||||
|
|
||||||
# get response from TVRage
|
# get response from TVRage
|
||||||
resp = sess.get(url, params=params)
|
resp = sess.get(url, params=params)
|
||||||
except Exception, e:
|
except requests.HTTPError, e:
|
||||||
if not str(e).startswith('HTTP Error'):
|
raise tvrage_error("HTTP error " + str(e.errno) + " while loading URL " + str(url))
|
||||||
|
|
||||||
|
except requests.ConnectionError, e:
|
||||||
lastTimeout = dt.datetime.now()
|
lastTimeout = dt.datetime.now()
|
||||||
raise tvrage_error("Could not connect to server: %s" % (e))
|
raise tvrage_error("Connection error " + str(e.message) + " while loading URL " + str(url))
|
||||||
|
|
||||||
|
except requests.Timeout, e:
|
||||||
|
lastTimeout = dt.datetime.now()
|
||||||
|
raise tvrage_error("Connection timed out " + str(e.message) + " while loading URL " + str(url))
|
||||||
|
|
||||||
|
except Exception, e:
|
||||||
|
lastTimeout = dt.datetime.now()
|
||||||
|
raise tvrage_error("Unknown exception while loading URL " + str(url) + ": " + str(e))
|
||||||
|
|
||||||
if 'application/zip' in resp.headers.get("Content-Type", ''):
|
if 'application/zip' in resp.headers.get("Content-Type", ''):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -191,6 +191,10 @@ Returns a byte-string retrieved from the url provider.
|
||||||
logger.log(u"Connection error " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
logger.log(u"Connection error " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
except requests.Timeout, e:
|
||||||
|
logger.log(u"Connection timed out " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
||||||
|
return None
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)
|
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)
|
||||||
return None
|
return None
|
||||||
|
@ -224,6 +228,10 @@ def download_file(url, filename):
|
||||||
logger.log(u"Connection error " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
logger.log(u"Connection error " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
except requests.Timeout, e:
|
||||||
|
logger.log(u"Connection timed out " + str(e.message) + " while loading URL " + url, logger.WARNING)
|
||||||
|
return False
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
_remove_file_failed(filename)
|
_remove_file_failed(filename)
|
||||||
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)
|
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)
|
||||||
|
|
|
@ -40,8 +40,8 @@ class ShowUpdater():
|
||||||
# update at 3 AM
|
# update at 3 AM
|
||||||
run_updater_time = datetime.time(hour=3)
|
run_updater_time = datetime.time(hour=3)
|
||||||
|
|
||||||
update_datetime = datetime.time.now()
|
update_datetime = datetime.datetime.now()
|
||||||
update_date = update_datetime.time
|
update_date = update_datetime.date()
|
||||||
|
|
||||||
logger.log(u"Checking update interval", logger.DEBUG)
|
logger.log(u"Checking update interval", logger.DEBUG)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class ShowUpdater():
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
# last_update_date <= 90 days, sorted ASC because dates are ordinal
|
# last_update_date <= 90 days, sorted ASC because dates are ordinal
|
||||||
sql_result = myDB.select("SELECT indexer_id FROM tv_shows WHERE status = 'Ended' AND last_update_indexer <= ? ORDER BY last_update_tvdb ASC LIMIT 10;", [stale_update_date])
|
sql_result = myDB.select("SELECT indexer_id FROM tv_shows WHERE status = 'Ended' AND last_update_indexer <= ? ORDER BY last_update_indexer ASC LIMIT 10;", [stale_update_date])
|
||||||
|
|
||||||
for cur_result in sql_result:
|
for cur_result in sql_result:
|
||||||
stale_should_update.append(cur_result['indexer_id'])
|
stale_should_update.append(cur_result['indexer_id'])
|
||||||
|
|
Loading…
Reference in a new issue