Fixed another issue in showUpdater.

This commit is contained in:
echel0n 2014-03-15 19:17:34 -07:00
parent e19e0e8d1c
commit fac97e5f5a
3 changed files with 24 additions and 6 deletions

View file

@ -366,10 +366,20 @@ class TVRage:
# get response from TVRage
resp = sess.get(url, params=params)
except Exception, e:
if not str(e).startswith('HTTP Error'):
except requests.HTTPError, e:
raise tvrage_error("HTTP error " + str(e.errno) + " while loading URL " + str(url))
except requests.ConnectionError, e:
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", ''):
try:

View file

@ -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)
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:
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)
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)
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:
_remove_file_failed(filename)
logger.log(u"Unknown exception while loading URL " + url + ": " + traceback.format_exc(), logger.WARNING)

View file

@ -40,8 +40,8 @@ class ShowUpdater():
# update at 3 AM
run_updater_time = datetime.time(hour=3)
update_datetime = datetime.time.now()
update_date = update_datetime.time
update_datetime = datetime.datetime.now()
update_date = update_datetime.date()
logger.log(u"Checking update interval", logger.DEBUG)
@ -86,7 +86,7 @@ class ShowUpdater():
myDB = db.DBConnection()
# 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:
stale_should_update.append(cur_result['indexer_id'])