pull/884/head
Louis Vézina 5 years ago
parent 7cfa3fe337
commit 83abf21687

@ -182,3 +182,4 @@ class PublicIPFilter(ArgsFilteringFilter):
def empty_log(): def empty_log():
fh.doRollover() fh.doRollover()
logging.info('BAZARR Log file emptied')

@ -444,19 +444,19 @@ def save_wizard():
@app.route('/emptylog') @app.route('/emptylog')
@login_required @login_required
def emptylog(): def emptylog():
ref = request.environ['HTTP_REFERER']
empty_log() empty_log()
logging.info('BAZARR Log file emptied') return '', 200
redirect(ref)
@app.route('/bazarr.log') @app.route('/bazarr.log')
@login_required @login_required
def download_log(): def download_log():
return send_file(os.path.join(args.config_dir, 'log/'), r = Response()
attachment_filename='bazarr.log') r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['Cache-Control'] = 'public, max-age=0'
return send_file(os.path.join(args.config_dir, 'log', 'bazarr.log'), cache_timeout=0)
@app.route('/image_proxy/<path:url>', methods=['GET']) @app.route('/image_proxy/<path:url>', methods=['GET'])

@ -15,12 +15,10 @@ from websocket_handler import event_stream
from subliminal import region as subliminal_cache_region from subliminal import region as subliminal_cache_region
import datetime import datetime
import glob import glob
from threading import Event
def history_log(action, sonarr_series_id, sonarr_episode_id, description, video_path=None, language=None, provider=None, def history_log(action, sonarr_series_id, sonarr_episode_id, description, video_path=None, language=None, provider=None,
score=None): score=None):
thread = Event()
database.execute("INSERT INTO table_history (action, sonarrSeriesId, sonarrEpisodeId, timestamp, description," database.execute("INSERT INTO table_history (action, sonarrSeriesId, sonarrEpisodeId, timestamp, description,"
"video_path, language, provider, score) VALUES (?,?,?,?,?,?,?,?,?)", "video_path, language, provider, score) VALUES (?,?,?,?,?,?,?,?,?)",
(action, sonarr_series_id, sonarr_episode_id, time.time(), description, video_path, language, (action, sonarr_series_id, sonarr_episode_id, time.time(), description, video_path, language,

@ -21,17 +21,19 @@
{% block bcright %} {% block bcright %}
<div class="d-flex m-t-5 justify-content-end"> <div class="d-flex m-t-5 justify-content-end">
<button class="btn btn-outline" class="dropdown"> <div class="dropdown">
<div class="dropdown-toggle" data-toggle="dropdown"><i class="fas fa-filter align-top text-themecolor text-center font-20" aria-hidden="true"></i></div> <button type="button" class="btn btn-outline" data-toggle="dropdown">
<div class="align-bottom text-themecolor small text-center">Filter</div> <i class="fas fa-filter align-top text-themecolor text-center font-20" aria-hidden="true"></i>
<div class="dropdown-menu dropdown-menu-right scale-up"> <div class="align-bottom text-themecolor small text-center">Filter</div>
</button>
<div id="filter_menu" class="dropdown-menu dropdown-menu-right">
<a href="" class="dropdown-item"><i class="far fa-circle" style="color: black;"></i> All</a> <a href="" class="dropdown-item"><i class="far fa-circle" style="color: black;"></i> All</a>
<a href="" class="dropdown-item"><i class="fas fa-info-circle" style="color: #1e90ff;"></i> Info</a> <a href="" class="dropdown-item"><i class="fas fa-info-circle" style="color: #1e90ff;"></i> Info</a>
<a href="" class="dropdown-item"><i class="fas fa-exclamation-circle" style="color: yellow;"></i> Warning</a> <a href="" class="dropdown-item"><i class="fas fa-exclamation-circle" style="color: yellow;"></i> Warning</a>
<a href="" class="dropdown-item"><i class="fas fa-bug" style="color: red;"></i> Error</a> <a href="" class="dropdown-item"><i class="fas fa-bug" style="color: red;"></i> Error</a>
<a href="" class="dropdown-item"><i class="fas fa-bug" style="color: black;"></i> Debug</a> <a href="" class="dropdown-item"><i class="fas fa-bug" style="color: black;"></i> Debug</a>
</div> </div>
</button> </div>
</div> </div>
{% endblock bcright %} {% endblock bcright %}
@ -124,7 +126,26 @@
"searchable": false "searchable": false
} }
] ]
} ); });
$('#refresh_button').on('click', function() {
table.ajax.reload();
table.columns.adjust().draw(false);
})
$('#download_button').on('click', function(e) {
e.preventDefault();
window.location.href = "{{ url_for('download_log') }}";
})
$('#empty_button').on('click', function() {
$.ajax({
url: "{{ url_for('emptylog') }}"
}).done(function (data) {
table.ajax.reload();
table.columns.adjust().draw(false);
})
})
}) })
</script> </script>
{% endblock tail %} {% endblock tail %}

Loading…
Cancel
Save