mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-12 17:03:59 +08:00
Reworking updating process
This commit is contained in:
parent
6a978ba19b
commit
60e0dc7b0d
1 changed files with 8 additions and 6 deletions
|
@ -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…
Reference in a new issue