mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Refactor updates configuration
This commit is contained in:
parent
2512218d4a
commit
c9e9d9748b
1 changed files with 27 additions and 22 deletions
|
@ -343,7 +343,6 @@ def configure_logging_part_2():
|
||||||
|
|
||||||
def configure_general():
|
def configure_general():
|
||||||
global VERSION_NOTIFY
|
global VERSION_NOTIFY
|
||||||
global AUTO_UPDATE
|
|
||||||
global GIT_REPO
|
global GIT_REPO
|
||||||
global GIT_PATH
|
global GIT_PATH
|
||||||
global GIT_USER
|
global GIT_USER
|
||||||
|
@ -356,7 +355,6 @@ def configure_general():
|
||||||
|
|
||||||
# Set Version and GIT variables
|
# Set Version and GIT variables
|
||||||
VERSION_NOTIFY = int(CFG['General']['version_notify'])
|
VERSION_NOTIFY = int(CFG['General']['version_notify'])
|
||||||
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
|
||||||
GIT_REPO = 'nzbToMedia'
|
GIT_REPO = 'nzbToMedia'
|
||||||
GIT_PATH = CFG['General']['git_path']
|
GIT_PATH = CFG['General']['git_path']
|
||||||
GIT_USER = CFG['General']['git_user'] or 'clinton-hall'
|
GIT_USER = CFG['General']['git_user'] or 'clinton-hall'
|
||||||
|
@ -368,6 +366,32 @@ def configure_general():
|
||||||
NOEXTRACTFAILED = int(CFG['General']['no_extract_failed'])
|
NOEXTRACTFAILED = int(CFG['General']['no_extract_failed'])
|
||||||
|
|
||||||
|
|
||||||
|
def configure_updates():
|
||||||
|
global AUTO_UPDATE
|
||||||
|
|
||||||
|
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
||||||
|
|
||||||
|
# Check for updates via GitHUB
|
||||||
|
if version_check.CheckVersion().check_for_new_version():
|
||||||
|
if AUTO_UPDATE == 1:
|
||||||
|
logger.info('Auto-Updating nzbToMedia, Please wait ...')
|
||||||
|
updated = version_check.CheckVersion().update()
|
||||||
|
if updated:
|
||||||
|
# restart nzbToMedia
|
||||||
|
try:
|
||||||
|
del MYAPP
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
restart()
|
||||||
|
else:
|
||||||
|
logger.error('Update wasn\'t successful, not restarting. Check your log for more information.')
|
||||||
|
|
||||||
|
# Set Current Version
|
||||||
|
logger.info('nzbToMedia Version:{version} Branch:{branch} ({system} {release})'.format
|
||||||
|
(version=NZBTOMEDIA_VERSION, branch=GIT_BRANCH,
|
||||||
|
system=platform.system(), release=platform.release()))
|
||||||
|
|
||||||
|
|
||||||
def initialize(section=None):
|
def initialize(section=None):
|
||||||
global NZBGET_POSTPROCESS_ERROR, NZBGET_POSTPROCESS_NONE, NZBGET_POSTPROCESS_PAR_CHECK, NZBGET_POSTPROCESS_SUCCESS, \
|
global NZBGET_POSTPROCESS_ERROR, NZBGET_POSTPROCESS_NONE, NZBGET_POSTPROCESS_PAR_CHECK, NZBGET_POSTPROCESS_SUCCESS, \
|
||||||
NZBTOMEDIA_TIMEOUT, FORKS, FORK_DEFAULT, FORK_FAILED_TORRENT, FORK_FAILED, SHOWEXTRACT, \
|
NZBTOMEDIA_TIMEOUT, FORKS, FORK_DEFAULT, FORK_FAILED_TORRENT, FORK_FAILED, SHOWEXTRACT, \
|
||||||
|
@ -405,26 +429,7 @@ def initialize(section=None):
|
||||||
main_db.upgrade_database(main_db.DBConnection(), databases.InitialSchema)
|
main_db.upgrade_database(main_db.DBConnection(), databases.InitialSchema)
|
||||||
|
|
||||||
configure_general()
|
configure_general()
|
||||||
|
configure_updates()
|
||||||
# Check for updates via GitHUB
|
|
||||||
if version_check.CheckVersion().check_for_new_version():
|
|
||||||
if AUTO_UPDATE == 1:
|
|
||||||
logger.info('Auto-Updating nzbToMedia, Please wait ...')
|
|
||||||
updated = version_check.CheckVersion().update()
|
|
||||||
if updated:
|
|
||||||
# restart nzbToMedia
|
|
||||||
try:
|
|
||||||
del MYAPP
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
restart()
|
|
||||||
else:
|
|
||||||
logger.error('Update wasn\'t successful, not restarting. Check your log for more information.')
|
|
||||||
|
|
||||||
# Set Current Version
|
|
||||||
logger.info('nzbToMedia Version:{version} Branch:{branch} ({system} {release})'.format
|
|
||||||
(version=NZBTOMEDIA_VERSION, branch=GIT_BRANCH,
|
|
||||||
system=platform.system(), release=platform.release()))
|
|
||||||
|
|
||||||
if int(CFG['WakeOnLan']['wake']) == 1:
|
if int(CFG['WakeOnLan']['wake']) == 1:
|
||||||
wake_up()
|
wake_up()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue