mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Option to update PlexPy automatically
This commit is contained in:
parent
83c304290b
commit
91716527a4
5 changed files with 22 additions and 4 deletions
|
@ -85,6 +85,12 @@
|
|||
<p class="help-block">If you have Git installed, allow periodic checks for updates.</p>
|
||||
</div>
|
||||
<div id="git_update_options">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="plexpy_auto_update" name="plexpy_auto_update" value="1" ${config['plexpy_auto_update']}> Update Automatically
|
||||
</label>
|
||||
<p class="help-block">Update PlexPy automatically if an update is available when checking for updates.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="git_token">GitHub API Token</label>
|
||||
<div class="row">
|
||||
|
|
|
@ -297,7 +297,7 @@ def initialize_scheduler():
|
|||
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)
|
||||
hours=0, minutes=github_minutes, seconds=0, args=(bool(CONFIG.PLEXPY_AUTO_UPDATE),))
|
||||
|
||||
backup_hours = CONFIG.BACKUP_INTERVAL if 1 <= CONFIG.BACKUP_INTERVAL <= 24 else 6
|
||||
|
||||
|
|
|
@ -384,6 +384,7 @@ _CONFIG_DEFINITIONS = {
|
|||
'PLEX_ON_PMSUPDATE': (int, 'Plex', 0),
|
||||
'PLEX_ON_CONCURRENT': (int, 'Plex', 0),
|
||||
'PLEX_ON_NEWDEVICE': (int, 'Plex', 0),
|
||||
'PLEXPY_AUTO_UPDATE': (int, 'General', 0),
|
||||
'PROWL_ENABLED': (int, 'Prowl', 0),
|
||||
'PROWL_KEYS': (str, 'Prowl', ''),
|
||||
'PROWL_PRIORITY': (int, 'Prowl', 0),
|
||||
|
|
|
@ -120,7 +120,7 @@ def getVersion():
|
|||
return None, 'master'
|
||||
|
||||
|
||||
def checkGithub():
|
||||
def checkGithub(auto_update=False):
|
||||
plexpy.COMMITS_BEHIND = 0
|
||||
|
||||
# Get the latest version available from github
|
||||
|
@ -163,6 +163,16 @@ def checkGithub():
|
|||
|
||||
if plexpy.COMMITS_BEHIND > 0:
|
||||
logger.info('New version is available. You are %s commits behind' % plexpy.COMMITS_BEHIND)
|
||||
|
||||
url = 'https://api.github.com/repos/%s/plexpy/releases/latest' % plexpy.CONFIG.GIT_USER
|
||||
release = request.request_json(url, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict)
|
||||
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.')
|
||||
plexpy.shutdown(restart=True, update=True)
|
||||
|
||||
elif plexpy.COMMITS_BEHIND == 0:
|
||||
logger.info('PlexPy is up to date')
|
||||
|
||||
|
|
|
@ -2587,7 +2587,8 @@ class WebInterface(object):
|
|||
"git_token": plexpy.CONFIG.GIT_TOKEN,
|
||||
"imgur_client_id": plexpy.CONFIG.IMGUR_CLIENT_ID,
|
||||
"cache_images": checked(plexpy.CONFIG.CACHE_IMAGES),
|
||||
"pms_version": plexpy.CONFIG.PMS_VERSION
|
||||
"pms_version": plexpy.CONFIG.PMS_VERSION,
|
||||
"plexpy_auto_update": checked(plexpy.CONFIG.PLEXPY_AUTO_UPDATE)
|
||||
}
|
||||
|
||||
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
|
||||
|
@ -2608,7 +2609,7 @@ class WebInterface(object):
|
|||
"notify_consecutive", "notify_upload_posters", "notify_recently_added", "notify_group_recently_added",
|
||||
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",
|
||||
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",
|
||||
"history_table_activity"
|
||||
"history_table_activity", "plexpy_auto_update"
|
||||
]
|
||||
for checked_config in checked_configs:
|
||||
if checked_config not in kwargs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue