mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-24 14:57:16 +08:00
WIP
This commit is contained in:
parent
6f5a55170f
commit
de02f5ea10
6 changed files with 80 additions and 6 deletions
|
@ -28,7 +28,7 @@ from notifier import send_notifications, send_notifications_movie
|
|||
from list_subtitles import store_subtitles, store_subtitles_movie, series_scan_subtitles, movies_scan_subtitles, \
|
||||
list_missing_subtitles, list_missing_subtitles_movies
|
||||
from utils import history_log, history_log_movie, get_sonarr_version, get_radarr_version
|
||||
from get_providers import get_providers, get_providers_auth, list_throttled_providers
|
||||
from get_providers import get_providers, get_providers_auth, list_throttled_providers, reset_throttled_providers
|
||||
from websocket_handler import event_stream
|
||||
from scheduler import Scheduler
|
||||
|
||||
|
@ -124,6 +124,14 @@ class Search(Resource):
|
|||
return jsonify(search_list)
|
||||
|
||||
|
||||
class ResetProviders(Resource):
|
||||
@authenticate
|
||||
def get(self):
|
||||
reset_throttled_providers()
|
||||
|
||||
return '', 200
|
||||
|
||||
|
||||
class SaveSettings(Resource):
|
||||
@authenticate
|
||||
def post(self):
|
||||
|
@ -1241,6 +1249,8 @@ api.add_resource(Languages, '/languages')
|
|||
|
||||
api.add_resource(Search, '/search_json')
|
||||
|
||||
api.add_resource(ResetProviders, '/resetproviders')
|
||||
|
||||
api.add_resource(SaveSettings, '/savesettings')
|
||||
|
||||
api.add_resource(SystemTasks, '/systemtasks')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/env python
|
||||
from flask import Flask, redirect
|
||||
from flask import Flask, redirect, render_template
|
||||
from flask_debugtoolbar import DebugToolbarExtension
|
||||
from flask_socketio import SocketIO
|
||||
import os
|
||||
|
@ -37,8 +37,8 @@ def create_app():
|
|||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def http_error_handler(error):
|
||||
return redirect(base_url.rstrip('/')), 302
|
||||
def page_not_found(e):
|
||||
return render_template('404.html'), 404
|
||||
|
||||
socketio.init_app(app, path=base_url.rstrip('/')+'/socket.io', cors_allowed_origins='*')
|
||||
return app
|
||||
|
|
|
@ -239,3 +239,13 @@ def list_throttled_providers():
|
|||
reason, until, throttle_desc = tp.get(provider, (None, None, None))
|
||||
throttled_providers.append([provider, reason, pretty.date(until)])
|
||||
return throttled_providers
|
||||
|
||||
|
||||
def reset_throttled_providers():
|
||||
for provider in list(tp):
|
||||
del tp[provider]
|
||||
settings.general.throtteled_providers = str(tp)
|
||||
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||
settings.write(handle)
|
||||
update_throttled_provider()
|
||||
logging.info('BAZARR throttled providers have been reset.')
|
||||
|
|
21
views/404.html
Normal file
21
views/404.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends '_main.html' %}
|
||||
|
||||
{% block title %}MIA - Bazarr{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
.content {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
{% endblock head %}
|
||||
|
||||
{% block body %}
|
||||
<div class="content">
|
||||
<br>
|
||||
<br>
|
||||
<h1>You must be lost, nothing to see here.</h1>
|
||||
<br>
|
||||
<img src="{{ url_for('static',filename='404.png') }}" height="350 px">
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -3,7 +3,16 @@
|
|||
{% block title %}Providers - Bazarr{% endblock %}
|
||||
|
||||
{% block bcleft %}
|
||||
|
||||
<div class="">
|
||||
<button class="btn btn-outline" id="refresh_button">
|
||||
<div><i class="fas fa-sync align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
|
||||
<div class="align-bottom text-themecolor small text-center">Refresh</div>
|
||||
</button>
|
||||
<button class="btn btn-outline" id="reset_button">
|
||||
<div><i class="fas fa-trash align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
|
||||
<div class="align-bottom text-themecolor small text-center">Reset Prov.</div>
|
||||
</button>
|
||||
</div>
|
||||
{% endblock bcleft %}
|
||||
|
||||
{% block bcright %}
|
||||
|
@ -46,6 +55,20 @@
|
|||
{ data: 2 }
|
||||
]
|
||||
});
|
||||
|
||||
$('#refresh_button').on('click', function() {
|
||||
table.ajax.reload();
|
||||
table.columns.adjust().draw(false);
|
||||
})
|
||||
|
||||
$('#reset_button').on('click', function() {
|
||||
$.ajax({
|
||||
url: "{{ url_for('api.resetproviders') }}"
|
||||
}).done(function () {
|
||||
table.ajax.reload();
|
||||
table.columns.adjust().draw(false);
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{% endblock tail %}
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
{% block title %}Tasks - Bazarr{% endblock %}
|
||||
|
||||
{% block bcleft %}
|
||||
|
||||
<div class="">
|
||||
<button class="btn btn-outline" id="refresh_button">
|
||||
<div><i class="fas fa-sync align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
|
||||
<div class="align-bottom text-themecolor small text-center">Refresh</div>
|
||||
</button>
|
||||
</div>
|
||||
{% endblock bcleft %}
|
||||
|
||||
{% block bcright %}
|
||||
|
@ -81,6 +86,11 @@
|
|||
]
|
||||
});
|
||||
|
||||
$('#refresh_button').on('click', function() {
|
||||
table.ajax.reload();
|
||||
table.columns.adjust().draw(false);
|
||||
})
|
||||
|
||||
$('#tasks').on('click', '.execute', function(e){
|
||||
e.preventDefault();
|
||||
const values = {
|
||||
|
|
Loading…
Reference in a new issue