mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Added in auto-updater feature, this will allow you to optionally have SickBeard run a version check in the background constantly searching for a new version release on GIT and when found it will automatically download and install then restart.
This commit is contained in:
parent
94670f7f95
commit
3f67782f38
@ -71,6 +71,18 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field-pair">
|
||||||
|
<input type="checkbox" name="auto_update" id="auto_update" #if $sickbeard.AUTO_UPDATE then "checked=\"checked\"" else ""#/>
|
||||||
|
<label class="clearfix" for="auto_update">
|
||||||
|
<span class="component-title">Automatic Updates</span>
|
||||||
|
<span class="component-desc">Automatically get and install updates for Sick Beard when available.</span>
|
||||||
|
</label>
|
||||||
|
<label class="nocheck clearfix">
|
||||||
|
<span class="component-title"> </span>
|
||||||
|
<span class="component-desc">Automatic Updates runs on startup and in the background.</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<input type="checkbox" name="sort_article" id="sort_article" #if $sickbeard.SORT_ARTICLE then "checked=\"checked\"" else ""#/>
|
<input type="checkbox" name="sort_article" id="sort_article" #if $sickbeard.SORT_ARTICLE then "checked=\"checked\"" else ""#/>
|
||||||
<label class="clearfix" for="sort_article">
|
<label class="clearfix" for="sort_article">
|
||||||
|
@ -77,6 +77,7 @@ backlogSearchScheduler = None
|
|||||||
currentSearchScheduler = None
|
currentSearchScheduler = None
|
||||||
showUpdateScheduler = None
|
showUpdateScheduler = None
|
||||||
versionCheckScheduler = None
|
versionCheckScheduler = None
|
||||||
|
autoUpdateScheduler = None
|
||||||
showQueueScheduler = None
|
showQueueScheduler = None
|
||||||
searchQueueScheduler = None
|
searchQueueScheduler = None
|
||||||
properFinderScheduler = None
|
properFinderScheduler = None
|
||||||
@ -95,6 +96,7 @@ metadata_provider_dict = {}
|
|||||||
NEWEST_VERSION = None
|
NEWEST_VERSION = None
|
||||||
NEWEST_VERSION_STRING = None
|
NEWEST_VERSION_STRING = None
|
||||||
VERSION_NOTIFY = None
|
VERSION_NOTIFY = None
|
||||||
|
AUTO_UPDATE = None
|
||||||
|
|
||||||
INIT_LOCK = Lock()
|
INIT_LOCK = Lock()
|
||||||
__INITIALIZED__ = False
|
__INITIALIZED__ = False
|
||||||
@ -469,7 +471,7 @@ def initialize(consoleLogging=True):
|
|||||||
USE_NMA, NMA_NOTIFY_ONSNATCH, NMA_NOTIFY_ONDOWNLOAD, NMA_NOTIFY_ONSUBTITLEDOWNLOAD, NMA_API, NMA_PRIORITY, \
|
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_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, \
|
USE_PUSHBULLET, PUSHBULLET_NOTIFY_ONSNATCH, PUSHBULLET_NOTIFY_ONDOWNLOAD, PUSHBULLET_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHBULLET_API, PUSHBULLET_DEVICE, \
|
||||||
versionCheckScheduler, VERSION_NOTIFY, PROCESS_AUTOMATICALLY, UNPACK, \
|
versionCheckScheduler, autoUpdateScheduler, VERSION_NOTIFY, AUTO_UPDATE, PROCESS_AUTOMATICALLY, UNPACK, \
|
||||||
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, \
|
KEEP_PROCESSED_DIR, PROCESS_METHOD, TV_DOWNLOAD_DIR, MIN_SEARCH_FREQUENCY, \
|
||||||
showQueueScheduler, searchQueueScheduler, ROOT_DIRS, CACHE_DIR, ACTUAL_CACHE_DIR, \
|
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, \
|
NAMING_PATTERN, NAMING_MULTI_EP, NAMING_FORCE_FOLDERS, NAMING_ABD_PATTERN, NAMING_CUSTOM_ABD, NAMING_STRIP_YEAR, \
|
||||||
@ -584,6 +586,7 @@ def initialize(consoleLogging=True):
|
|||||||
QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)
|
QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)
|
||||||
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
|
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
|
||||||
VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)
|
VERSION_NOTIFY = check_setting_int(CFG, 'General', 'version_notify', 1)
|
||||||
|
AUTO_UPDATE = check_setting_int(CFG, 'General', 'auto_update', 1)
|
||||||
FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))
|
FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))
|
||||||
|
|
||||||
PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split()
|
PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split()
|
||||||
@ -975,6 +978,12 @@ def initialize(consoleLogging=True):
|
|||||||
threadName="CHECKVERSION",
|
threadName="CHECKVERSION",
|
||||||
runImmediately=True)
|
runImmediately=True)
|
||||||
|
|
||||||
|
autoUpdateScheduler = scheduler.Scheduler(versionChecker.AutoUpdate(),
|
||||||
|
cycleTime=datetime.timedelta(seconds=3),
|
||||||
|
threadName="AUTOUPDATER",
|
||||||
|
runImmediately=True,
|
||||||
|
silent=True)
|
||||||
|
|
||||||
showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),
|
showQueueScheduler = scheduler.Scheduler(show_queue.ShowQueue(),
|
||||||
cycleTime=datetime.timedelta(seconds=3),
|
cycleTime=datetime.timedelta(seconds=3),
|
||||||
threadName="SHOWQUEUE",
|
threadName="SHOWQUEUE",
|
||||||
@ -1032,7 +1041,7 @@ def initialize(consoleLogging=True):
|
|||||||
|
|
||||||
def start():
|
def start():
|
||||||
global __INITIALIZED__, currentSearchScheduler, backlogSearchScheduler, \
|
global __INITIALIZED__, currentSearchScheduler, backlogSearchScheduler, \
|
||||||
showUpdateScheduler, versionCheckScheduler, showQueueScheduler, \
|
showUpdateScheduler, versionCheckScheduler, autoUpdateScheduler, showQueueScheduler, \
|
||||||
properFinderScheduler, autoPostProcesserScheduler, searchQueueScheduler, \
|
properFinderScheduler, autoPostProcesserScheduler, searchQueueScheduler, \
|
||||||
subtitlesFinderScheduler, started, USE_SUBTITLES, \
|
subtitlesFinderScheduler, started, USE_SUBTITLES, \
|
||||||
traktWatchListCheckerSchedular, started
|
traktWatchListCheckerSchedular, started
|
||||||
@ -1053,6 +1062,9 @@ def start():
|
|||||||
# start the version checker
|
# start the version checker
|
||||||
versionCheckScheduler.thread.start()
|
versionCheckScheduler.thread.start()
|
||||||
|
|
||||||
|
# start the version checker
|
||||||
|
autoUpdateScheduler.thread.start()
|
||||||
|
|
||||||
# start the queue checker
|
# start the queue checker
|
||||||
showQueueScheduler.thread.start()
|
showQueueScheduler.thread.start()
|
||||||
|
|
||||||
@ -1117,6 +1129,13 @@ def halt():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
autoUpdateScheduler.abort = True
|
||||||
|
logger.log(u"Waiting for the AUTOUPDATER thread to exit")
|
||||||
|
try:
|
||||||
|
autoUpdateScheduler.thread.join(10)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
showQueueScheduler.abort = True
|
showQueueScheduler.abort = True
|
||||||
logger.log(u"Waiting for the SHOWQUEUE thread to exit")
|
logger.log(u"Waiting for the SHOWQUEUE thread to exit")
|
||||||
try:
|
try:
|
||||||
@ -1289,6 +1308,7 @@ def save_config():
|
|||||||
new_config['General']['flatten_folders_default'] = int(FLATTEN_FOLDERS_DEFAULT)
|
new_config['General']['flatten_folders_default'] = int(FLATTEN_FOLDERS_DEFAULT)
|
||||||
new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)
|
new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)
|
||||||
new_config['General']['version_notify'] = int(VERSION_NOTIFY)
|
new_config['General']['version_notify'] = int(VERSION_NOTIFY)
|
||||||
|
new_config['General']['auto_update'] = int(AUTO_UPDATE)
|
||||||
new_config['General']['naming_strip_year'] = int(NAMING_STRIP_YEAR)
|
new_config['General']['naming_strip_year'] = int(NAMING_STRIP_YEAR)
|
||||||
new_config['General']['naming_pattern'] = NAMING_PATTERN
|
new_config['General']['naming_pattern'] = NAMING_PATTERN
|
||||||
new_config['General']['naming_custom_abd'] = int(NAMING_CUSTOM_ABD)
|
new_config['General']['naming_custom_abd'] = int(NAMING_CUSTOM_ABD)
|
||||||
|
@ -89,7 +89,7 @@ class CheckVersion():
|
|||||||
|
|
||||||
return install_type
|
return install_type
|
||||||
|
|
||||||
def check_for_new_version(self, force=False):
|
def check_for_new_version(self, force=False, silent=False):
|
||||||
"""
|
"""
|
||||||
Checks the internet for a newer version.
|
Checks the internet for a newer version.
|
||||||
|
|
||||||
@ -102,9 +102,11 @@ class CheckVersion():
|
|||||||
logger.log(u"Version checking is disabled, not checking for the newest version")
|
logger.log(u"Version checking is disabled, not checking for the newest version")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if not silent:
|
||||||
logger.log(u"Checking if " + self.install_type + " needs an update")
|
logger.log(u"Checking if " + self.install_type + " needs an update")
|
||||||
if not self.updater.need_update():
|
if not self.updater.need_update():
|
||||||
sickbeard.NEWEST_VERSION_STRING = None
|
sickbeard.NEWEST_VERSION_STRING = None
|
||||||
|
if not silent:
|
||||||
logger.log(u"No update needed")
|
logger.log(u"No update needed")
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
@ -118,6 +120,14 @@ class CheckVersion():
|
|||||||
if self.updater.need_update():
|
if self.updater.need_update():
|
||||||
return self.updater.update()
|
return self.updater.update()
|
||||||
|
|
||||||
|
class AutoUpdate():
|
||||||
|
def run(self):
|
||||||
|
if CheckVersion().check_for_new_version(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():
|
class UpdateManager():
|
||||||
def get_github_repo_user(self):
|
def get_github_repo_user(self):
|
||||||
|
@ -976,7 +976,7 @@ class ConfigGeneral:
|
|||||||
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None,
|
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None,
|
||||||
update_shows_on_start=None, launch_browser=None, web_username=None, use_api=None, api_key=None,
|
update_shows_on_start=None, launch_browser=None, web_username=None, use_api=None, api_key=None,
|
||||||
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
||||||
sort_article=None,
|
sort_article=None, auto_update=None,
|
||||||
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None):
|
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None):
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
@ -984,6 +984,7 @@ class ConfigGeneral:
|
|||||||
# Misc
|
# Misc
|
||||||
sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser)
|
sickbeard.LAUNCH_BROWSER = config.checkbox_to_value(launch_browser)
|
||||||
config.change_VERSION_NOTIFY(config.checkbox_to_value(version_notify))
|
config.change_VERSION_NOTIFY(config.checkbox_to_value(version_notify))
|
||||||
|
sickbeard.AUTO_UPDATE = config.checkbox_to_value(auto_update)
|
||||||
# sickbeard.LOG_DIR is set in config.change_LOG_DIR()
|
# sickbeard.LOG_DIR is set in config.change_LOG_DIR()
|
||||||
|
|
||||||
sickbeard.UPDATE_SHOWS_ON_START = config.checkbox_to_value(update_shows_on_start)
|
sickbeard.UPDATE_SHOWS_ON_START = config.checkbox_to_value(update_shows_on_start)
|
||||||
|
Loading…
Reference in New Issue
Block a user