Only notify Tautulli updates when checked as a scheduled task (Fixes Tautulli/Tautulli-Issues#46)

This commit is contained in:
JonnyWong16 2018-04-28 17:59:53 -07:00
parent 5e000162c6
commit 5f7991665c
3 changed files with 10 additions and 7 deletions

View file

@ -243,7 +243,7 @@ def initialize(config_file):
# Check for new versions
if CONFIG.CHECK_GITHUB_ON_STARTUP and CONFIG.CHECK_GITHUB:
try:
LATEST_VERSION = versioncheck.checkGithub()
LATEST_VERSION = versioncheck.check_github()
except:
logger.exception(u"Unhandled exception")
LATEST_VERSION = CURRENT_VERSION
@ -378,8 +378,8 @@ 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.checkGithub, 'Check GitHub for updates',
hours=0, minutes=github_minutes, seconds=0, args=(bool(CONFIG.PLEXPY_AUTO_UPDATE),))
schedule_job(versioncheck.check_github, '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

View file

@ -131,7 +131,7 @@ def getVersion():
return None, 'origin', common.BRANCH
def checkGithub(auto_update=False):
def check_github(auto_update=False, notify=False):
plexpy.COMMITS_BEHIND = 0
# Get the latest version available from github
@ -198,8 +198,11 @@ def checkGithub(auto_update=False):
plexpy.LATEST_RELEASE = release['tag_name']
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_plexpyupdate', 'plexpy_download_info': release,
'plexpy_update_commit': plexpy.LATEST_VERSION, 'plexpy_update_behind': plexpy.COMMITS_BEHIND})
if notify:
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_plexpyupdate',
'plexpy_download_info': release,
'plexpy_update_commit': plexpy.LATEST_VERSION,
'plexpy_update_behind': plexpy.COMMITS_BEHIND})
if auto_update:
logger.info('Running automatic update.')

View file

@ -3699,7 +3699,7 @@ class WebInterface(object):
}
```
"""
versioncheck.checkGithub()
versioncheck.check_github()
if not plexpy.CURRENT_VERSION:
return {'result': 'error',