bazarr/check_update.py

14 lines
542 B
Python
Raw Normal View History

2017-10-28 10:18:16 +08:00
from get_general_settings import *
2017-11-07 12:53:31 +08:00
import os
2017-11-07 12:23:36 +08:00
import subprocess
2017-11-07 12:53:31 +08:00
2017-11-07 13:17:14 +08:00
def check_and_apply_update():
2017-11-10 05:13:14 +08:00
result = subprocess.check_output(["git", "pull", '--dry-run', 'origin', branch], stderr=subprocess.STDOUT, shell=True, cwd=os.path.join(os.path.dirname(__file__))).split('\n')
2017-11-07 13:11:42 +08:00
if result[2] is not '':
2017-11-10 05:13:14 +08:00
subprocess.check_output(["git", "pull", 'origin', branch], shell=True, cwd=os.path.join(os.path.dirname(__file__)))
2017-11-07 13:11:42 +08:00
os.execlp('python', 'python ' + os.path.join(os.path.dirname(__file__), 'bazarr.py'))
2017-11-10 05:13:14 +08:00
return result