diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html
index f4f366c0..e448e56a 100644
--- a/data/interfaces/default/settings.html
+++ b/data/interfaces/default/settings.html
@@ -265,6 +265,19 @@
Optional: The path to your git environment variable. Leave blank for default.
+
% endif
@@ -2154,6 +2167,13 @@ $(document).ready(function() {
}
});
+ $("#reset_git_install").click(function () {
+ var msg = 'Are you sure you want to reset your Tautulli installtion?';
+ var url = 'reset_git_install';
+ confirmAjaxCall(url, msg);
+ });
+
+
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_api").click(function() {
$.get('generate_api_key',
diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py
index 7ec34725..31bd4408 100644
--- a/plexpy/versioncheck.py
+++ b/plexpy/versioncheck.py
@@ -259,13 +259,10 @@ def update():
return
for line in output.split('\n'):
-
- if 'Already up-to-date.' in line:
+ if 'Already up-to-date.' in line or 'Already up to date.' in line:
logger.info('No update available, not updating')
- logger.info('Output: ' + str(output))
elif line.endswith(('Aborting', 'Aborting.')):
logger.error('Unable to update from git: ' + line)
- logger.info('Output: ' + str(output))
elif plexpy.INSTALL_TYPE == 'docker':
return
@@ -331,6 +328,34 @@ def update():
return
+def reset():
+ if plexpy.INSTALL_TYPE == 'git':
+ logger.info('Attempting to reset git install to "%s/%s"' % (plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH))
+ output, err = runGit('remote set-url {} https://github.com/{}/{}.git'.format(plexpy.CONFIG.GIT_REMOTE,
+ plexpy.CONFIG.GIT_USER,
+ plexpy.CONFIG.GIT_REPO))
+ output, err = runGit('fetch {}'.format(plexpy.CONFIG.GIT_REMOTE))
+ output, err = runGit('checkout {}'.format(plexpy.CONFIG.GIT_BRANCH))
+ output, err = runGit('branch -u {}/{}'.format(plexpy.CONFIG.GIT_REMOTE,
+ plexpy.CONFIG.GIT_BRANCH))
+ output, err = runGit('reset --hard {}/{}'.format(plexpy.CONFIG.GIT_REMOTE,
+ plexpy.CONFIG.GIT_BRANCH))
+ output, err = runGit('pull {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
+ plexpy.CONFIG.GIT_BRANCH))
+
+ if not output:
+ logger.error('Unable to reset Tautulli installation.')
+ return False
+
+ for line in output.split('\n'):
+ if 'Already up-to-date.' in line or 'Already up to date.' in line:
+ logger.info('Tautulli installation reset successfully.')
+ return True
+ elif line.endswith(('Aborting', 'Aborting.')):
+ logger.error('Unable to reset Tautulli installation: ' + line)
+ return False
+
+
def checkout_git_branch():
if plexpy.INSTALL_TYPE == 'git':
output, err = runGit('fetch %s' % plexpy.CONFIG.GIT_REMOTE)
@@ -343,9 +368,10 @@ def checkout_git_branch():
for line in output.split('\n'):
if line.endswith(('Aborting', 'Aborting.')):
logger.error('Unable to checkout from git: ' + line)
- logger.info('Output: ' + str(output))
+ return
- output, err = runGit('pull %s %s' % (plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH))
+ output, err = runGit('pull {} {}'.format(plexpy.CONFIG.GIT_REMOTE,
+ plexpy.CONFIG.GIT_BRANCH))
def read_changelog(latest_only=False, since_prev_release=False):
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index cf0dba47..dae7e1e9 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -3916,6 +3916,18 @@ class WebInterface(object):
plexpy.CONFIG.write()
return self.do_state_change('checkout', 'Switching Git Branches', 120)
+ @cherrypy.expose
+ @cherrypy.tools.json_out()
+ @requireAuth(member_of("admin"))
+ def reset_git_install(self, **kwargs):
+ result = versioncheck.reset()
+
+ if result:
+ return {'result': 'success', 'message': 'Tautulli installation reset.'}
+ else:
+ return {'result': 'error', 'message': 'Reset installation failed.'}
+
+
@cherrypy.expose
@requireAuth(member_of("admin"))
def get_changelog(self, latest_only=False, since_prev_release=False, update_shown=False, **kwargs):