This commit is contained in:
Louis Vézina 2020-02-17 21:45:12 -05:00
parent 7cfa3fe337
commit 83abf21687
4 changed files with 35 additions and 15 deletions

View File

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

View File

@ -444,19 +444,19 @@ def save_wizard():
@app.route('/emptylog')
@login_required
def emptylog():
ref = request.environ['HTTP_REFERER']
empty_log()
logging.info('BAZARR Log file emptied')
redirect(ref)
return '', 200
@app.route('/bazarr.log')
@login_required
def download_log():
return send_file(os.path.join(args.config_dir, 'log/'),
attachment_filename='bazarr.log')
r = Response()
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'])

View File

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

View File

@ -21,17 +21,19 @@
{% block bcright %}
<div class="d-flex m-t-5 justify-content-end">
<button class="btn btn-outline" 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>
<div class="align-bottom text-themecolor small text-center">Filter</div>
<div class="dropdown-menu dropdown-menu-right scale-up">
<div class="dropdown">
<button type="button" class="btn btn-outline" data-toggle="dropdown">
<i class="fas fa-filter align-top text-themecolor text-center font-20" aria-hidden="true"></i>
<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="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-bug" style="color: red;"></i> Error</a>
<a href="" class="dropdown-item"><i class="fas fa-bug" style="color: black;"></i> Debug</a>
</div>
</button>
</div>
</div>
{% endblock bcright %}
@ -124,7 +126,26 @@
"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>
{% endblock tail %}