Added a mirror URL for checking updates if the main URL is not working

This commit is contained in:
Manuel Cortez 2016-02-19 09:15:46 -06:00
parent 32067d3171
commit 229f698e72
2 changed files with 14 additions and 7 deletions

View File

@ -4,9 +4,11 @@ snapshot = True
if snapshot == False: if snapshot == False:
version = "0.80" version = "0.80"
update_url = 'http://twblue.es/updates/twblue_ngen.json' update_url = 'http://twblue.es/updates/twblue_ngen.json'
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/stable.json'
else: else:
version = "10.99" version = "10.99"
update_url = 'http://twblue.es/updates/snapshots_ngen.json' update_url = 'http://twblue.es/updates/snapshots_ngen.json'
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json'
author = u"Manuel Cortéz" author = u"Manuel Cortéz"
authorEmail = "manuel@manuelcortez.net" authorEmail = "manuel@manuelcortez.net"
copyright = u"Copyright (C) 2015, Technow S.L. \nCopyright (C) 2013-2015, Manuel cortéz." copyright = u"Copyright (C) 2015, Technow S.L. \nCopyright (C) 2013-2015, Manuel cortéz."

View File

@ -2,14 +2,19 @@
import application import application
import update import update
import platform import platform
from wxUpdater import *
import logging import logging
import output import output
from requests.exceptions import ConnectionError
from wxUpdater import *
logger = logging.getLogger("updater") logger = logging.getLogger("updater")
def do_update(): def do_update(endpoint=application.update_url):
# try: try:
return update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished) update.perform_update(endpoint=endpoint, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
# except: except ConnectionError:
# logger.exception("Update failed.") if endpoint == application.update_url:
# output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True) logger.error("Update failed! Using mirror URL...")
return do_update(endpoint=application.mirror_update_url)
else:
logger.exception("Update failed.")
output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True)