1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Testing auto-updater

This commit is contained in:
echel0n 2014-04-23 00:47:42 -07:00
parent b024fe3e3b
commit d6927f1c0d
2 changed files with 15 additions and 35 deletions

View File

@ -77,7 +77,6 @@ backlogSearchScheduler = None
currentSearchScheduler = None
showUpdateScheduler = None
versionCheckScheduler = None
autoUpdateScheduler = None
showQueueScheduler = None
searchQueueScheduler = None
properFinderScheduler = None
@ -471,7 +470,7 @@ def initialize(consoleLogging=True):
USE_NMA, NMA_NOTIFY_ONSNATCH, NMA_NOTIFY_ONDOWNLOAD, NMA_NOTIFY_ONSUBTITLEDOWNLOAD, NMA_API, NMA_PRIORITY, \
USE_PUSHALOT, PUSHALOT_NOTIFY_ONSNATCH, PUSHALOT_NOTIFY_ONDOWNLOAD, PUSHALOT_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHALOT_AUTHORIZATIONTOKEN, \
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
versionCheckScheduler, autoUpdateScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \
versionCheckScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, \
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, \
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_STRIP_YEAR, \
@ -974,16 +973,10 @@ def initialize(consoleLogging=True):
runImmediately=False)
versionCheckScheduler = scheduler.Scheduler(versionChecker.CheckVersion(),
cycleTime=datetime.timedelta(hours=12),
cycleTime=datetime.timedelta(minutes=5),
threadName="CHECKVERSION",
runImmediately=True)
autoUpdateScheduler = scheduler.Scheduler(versionChecker.AutoUpdate(),
cycleTime=datetime.timedelta(minutes=5),
threadName="AUTOUPDATER",
runImmediately=True,
silent=True)
showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),
cycleTime=datetime.timedelta(seconds=3),
threadName="SHOWQUEUE",
@ -1041,7 +1034,7 @@ def initialize(consoleLogging=True):
def start():
global __INITIALIZED__, currentSearchScheduler, backlogSearchScheduler, \
showUpdateScheduler, versionCheckScheduler, autoUpdateScheduler, showQueueScheduler, \
showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \
properFinderScheduler, autoPostProcesserScheduler, searchQueueScheduler, \
subtitlesFinderScheduler, started, USE_SUBTITLES, \
traktWatchListCheckerSchedular, started
@ -1062,9 +1055,6 @@ def start():
# start the version checker
versionCheckScheduler.thread.start()
# start the version checker
autoUpdateScheduler.thread.start()
# start the queue checker
showQueueScheduler.thread.start()
@ -1129,13 +1119,6 @@ def halt():
except:
pass
autoUpdateScheduler.abort = True
logger.log(u"Waiting for the AUTOUPDATER thread to exit")
try:
autoUpdateScheduler.thread.join(10)
except:
pass
showQueueScheduler.abort = True
logger.log(u"Waiting for the SHOWQUEUE thread to exit")
try:

View File

@ -57,7 +57,13 @@ class CheckVersion():
self.updater = None
def run(self):
self.check_for_new_version()
if self.check_for_new_version():
if sickbeard.AUTO_UPDATE:
logger.log(u"New update found for SickBeard, starting auto-updater ...")
updated = sickbeard.versionCheckScheduler.action.update()
if updated:
logger.log(u"Update was successfull, restarting SickBeard ...")
sickbeard.restart()
# refresh scene exceptions too
scene_exceptions.retrieve_exceptions()
@ -89,7 +95,7 @@ class CheckVersion():
return install_type
def check_for_new_version(self, force=False, silent=False):
def check_for_new_version(self, force=False):
"""
Checks the internet for a newer version.
@ -98,18 +104,18 @@ class CheckVersion():
force: if true the VERSION_NOTIFY setting will be ignored and a check will be forced
"""
if not sickbeard.VERSION_NOTIFY and not force:
if not sickbeard.VERSION_NOTIFY and not sickbeard.AUTO_UPDATE and not force:
logger.log(u"Version checking is disabled, not checking for the newest version")
return False
if not silent:
if not sickbeard.AUTO_UPDATE:
logger.log(u"Checking if " + self.install_type + " needs an update")
if not self.updater.need_update():
sickbeard.NEWEST_VERSION_STRING = None
if not silent:
if not sickbeard.AUTO_UPDATE:
logger.log(u"No update needed")
if force and not silent:
if force and not sickbeard.AUTO_UPDATE:
ui.notifications.message('No update needed')
return False
@ -120,15 +126,6 @@ class CheckVersion():
if self.updater.need_update():
return self.updater.update()
class AutoUpdate():
def run(self):
if CheckVersion().check_for_new_version(force=True, silent=True):
logger.log(u"New update found for SickBeard, starting auto-updater ...")
updated = sickbeard.versionCheckScheduler.action.update()
if updated:
logger.log(u"Update was successfull, restarting SickBeard ...")
sickbeard.restart()
class UpdateManager():
def get_github_repo_user(self):
return 'echel0n'