Refactor update check

This commit is contained in:
JonnyWong16 2018-08-14 19:23:20 -07:00
parent 4f4a66f7e7
commit 13dac9c1ea
5 changed files with 29 additions and 15 deletions

View file

@ -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