mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Refactor update check
This commit is contained in:
parent
4f4a66f7e7
commit
13dac9c1ea
5 changed files with 29 additions and 15 deletions
|
@ -92,6 +92,7 @@ LATEST_VERSION = None
|
|||
COMMITS_BEHIND = None
|
||||
PREV_RELEASE = None
|
||||
LATEST_RELEASE = None
|
||||
UPDATE_AVAILABLE = False
|
||||
|
||||
UMASK = None
|
||||
|
||||
|
@ -259,7 +260,7 @@ def initialize(config_file):
|
|||
# Check for new versions
|
||||
if CONFIG.CHECK_GITHUB_ON_STARTUP and CONFIG.CHECK_GITHUB:
|
||||
try:
|
||||
LATEST_VERSION = versioncheck.check_github()
|
||||
LATEST_VERSION = versioncheck.check_update()
|
||||
except:
|
||||
logger.exception(u"Unhandled exception")
|
||||
LATEST_VERSION = CURRENT_VERSION
|
||||
|
@ -421,7 +422,7 @@ def initialize_scheduler():
|
|||
# Update check
|
||||
github_minutes = CONFIG.CHECK_GITHUB_INTERVAL if CONFIG.CHECK_GITHUB_INTERVAL and CONFIG.CHECK_GITHUB else 0
|
||||
|
||||
schedule_job(versioncheck.check_github, 'Check GitHub for updates',
|
||||
schedule_job(versioncheck.check_update, 'Check GitHub for updates',
|
||||
hours=0, minutes=github_minutes, seconds=0, args=(bool(CONFIG.PLEXPY_AUTO_UPDATE), True))
|
||||
|
||||
backup_hours = CONFIG.BACKUP_INTERVAL if 1 <= CONFIG.BACKUP_INTERVAL <= 24 else 6
|
||||
|
|
|
@ -131,6 +131,21 @@ def getVersion():
|
|||
return None, 'origin', common.BRANCH
|
||||
|
||||
|
||||
def check_update(auto_update=False, notify=False):
|
||||
check_github(auto_update=auto_update, notify=notify)
|
||||
|
||||
if not plexpy.CURRENT_VERSION:
|
||||
plexpy.UPDATE_AVAILABLE = None
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and \
|
||||
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
||||
plexpy.UPDATE_AVAILABLE = 'release'
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and \
|
||||
plexpy.INSTALL_TYPE != 'win':
|
||||
plexpy.UPDATE_AVAILABLE = 'commit'
|
||||
else:
|
||||
plexpy.UPDATE_AVAILABLE = False
|
||||
|
||||
|
||||
def check_github(auto_update=False, notify=False):
|
||||
plexpy.COMMITS_BEHIND = 0
|
||||
|
||||
|
|
|
@ -3803,16 +3803,15 @@ class WebInterface(object):
|
|||
}
|
||||
```
|
||||
"""
|
||||
versioncheck.check_github()
|
||||
versioncheck.check_update()
|
||||
|
||||
if not plexpy.CURRENT_VERSION:
|
||||
if plexpy.UPDATE_AVAILABLE is None:
|
||||
return {'result': 'error',
|
||||
'update': None,
|
||||
'message': 'You are running an unknown version of Tautulli.'
|
||||
}
|
||||
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and \
|
||||
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
||||
elif plexpy.UPDATE_AVAILABLE == 'release':
|
||||
return {'result': 'success',
|
||||
'update': True,
|
||||
'release': True,
|
||||
|
@ -3825,8 +3824,7 @@ class WebInterface(object):
|
|||
plexpy.LATEST_RELEASE))
|
||||
}
|
||||
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and \
|
||||
plexpy.INSTALL_TYPE != 'win':
|
||||
elif plexpy.UPDATE_AVAILABLE == 'commit':
|
||||
return {'result': 'success',
|
||||
'update': True,
|
||||
'release': False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue