Reworking updating process

pull/115/merge
morpheus65535 7 years ago
parent 6a978ba19b
commit 60e0dc7b0d

@ -26,14 +26,16 @@ def gitconfig():
def check_and_apply_update(): def check_and_apply_update():
gitconfig() gitconfig()
g = git.cmd.Git(current_working_directory) g = git.cmd.Git(current_working_directory)
result = g.pull('origin', branch) result = g.diff('--shortstat', 'origin/' + branch)
if result.startswith('Already'): if len(result) == 0:
logging.info('No new version of Bazarr available.') logging.info('No new version of Bazarr available.')
elif result.startswith('Updating') or result.startswith('Merge made'):
logging.info('Bazarr updated to latest version and need to be restarted.')
updated()
else: else:
logging.info(result) g.reset('--hard', 'HEAD')
g.checkout(branch)
g.reset('--hard','origin/' + branch)
g.pull('origin/' + branch)
logging.info('Bazarr updated to latest version and need to be restarted. ' + result)
updated()
def updated(): def updated():
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)

Loading…
Cancel
Save