mirror of
https://github.com/morpheus65535/bazarr
synced 2025-03-03 10:06:24 +00:00
Updating improvement
This commit is contained in:
parent
200b6e0a76
commit
ee9ef5e790
4 changed files with 13 additions and 6 deletions
|
@ -302,7 +302,8 @@ def save_settings():
|
|||
def check_update():
|
||||
ref = request.environ['HTTP_REFERER']
|
||||
|
||||
check_and_apply_update()
|
||||
result = check_and_apply_update()
|
||||
logging.info(result)
|
||||
|
||||
redirect(ref)
|
||||
|
||||
|
|
|
@ -15,13 +15,17 @@ def check_and_apply_update(repo=local_repo, remote_name='origin'):
|
|||
merge_result, _ = repo.merge_analysis(remote_id)
|
||||
# Up to date, do nothing
|
||||
if merge_result & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
|
||||
print 'Up to date'
|
||||
return
|
||||
result = 'No new version of Bazarr available.'
|
||||
pass
|
||||
# We can just fastforward
|
||||
elif merge_result & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD:
|
||||
repo.checkout_tree(repo.get(remote_id))
|
||||
master_ref = repo.lookup_reference('refs/heads/master')
|
||||
master_ref.set_target(remote_id)
|
||||
repo.head.set_target(remote_id)
|
||||
result = 'Bazarr updated to latest version.'
|
||||
os.execlp('python', 'python', os.path.join(os.path.dirname(__file__), 'bazarr.py'))
|
||||
else:
|
||||
raise AssertionError('Unknown merge analysis result')
|
||||
|
||||
return result
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from get_general_settings import *
|
||||
from get_series import *
|
||||
from get_episodes import *
|
||||
from get_subtitle import *
|
||||
|
@ -6,7 +7,8 @@ from check_update import *
|
|||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(check_and_apply_update, 'interval', hours=6, max_instances=1, coalesce=True, id='update_bazarr', name='Update bazarr from source on Github')
|
||||
if automatic == 'True':
|
||||
scheduler.add_job(check_and_apply_update, 'interval', hours=6, max_instances=1, coalesce=True, id='update_bazarr', name='Update bazarr from source on Github')
|
||||
scheduler.add_job(update_series, 'interval', minutes=1, max_instances=1, coalesce=True, id='update_series', name='Update series list from Sonarr')
|
||||
scheduler.add_job(add_new_episodes, 'interval', minutes=1, max_instances=1, coalesce=True, id='add_new_episodes', name='Add new episodes from Sonarr')
|
||||
scheduler.add_job(wanted_search_missing_subtitles, 'interval', minutes=15, max_instances=1, coalesce=True, id='wanted_search_missing_subtitles', name='Search for wanted subtitles')
|
||||
|
|
|
@ -236,7 +236,7 @@
|
|||
<label>Manual update</label>
|
||||
</div>
|
||||
<div class="eleven wide column">
|
||||
<button id="settings_general_check_update" class="ui blue button">Check now and update</button>
|
||||
<a id="settings_general_check_update" class="ui blue button">Check now and update</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -372,7 +372,7 @@
|
|||
;
|
||||
|
||||
$('#settings_general_check_update').click(function(){
|
||||
window.location.href = '{{base_url}}check_update';
|
||||
window.location = '{{base_url}}check_update';
|
||||
})
|
||||
|
||||
$('a:not(.tabs), button:not(.cancel)').click(function(){
|
||||
|
|
Loading…
Reference in a new issue