diff --git a/bazarr/main.py b/bazarr/main.py index 76d34a469..52c85ae7c 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -16,8 +16,8 @@ import ast import hashlib import warnings import queueconfig -import platform import apprise +import requests from get_args import args @@ -38,13 +38,12 @@ from get_languages import load_language_in_db, language_from_alpha3, language_fr from flask import make_response, request, redirect, abort, render_template, Response, session, flash, url_for, \ send_file, stream_with_context -from get_providers import get_providers, get_providers_auth, list_throttled_providers from get_series import * from get_episodes import * from get_movies import * -from utils import history_log, history_log_movie, get_sonarr_version, get_radarr_version from scheduler import Scheduler +from check_update import check_and_apply_update from subliminal_patch.extensions import provider_registry as provider_manager from functools import wraps @@ -173,6 +172,7 @@ def logout(): def shutdown(): doShutdown() + def doShutdown(): try: server.stop() @@ -598,16 +598,19 @@ def settingssonarr(): return render_template('settingssonarr.html') -@app.route('/check_update') +@app.route('/settingsradarr/') @login_required -def check_update(): +def settingsradarr(): + return render_template('settingsradarr.html') - ref = request.environ['HTTP_REFERER'] +@app.route('/check_update') +@login_required +def check_update(): if not args.no_update: check_and_apply_update() - redirect(ref) + return '', 200 @app.route('/systemtasks') @@ -640,21 +643,6 @@ def systemreleases(): return render_template('systemreleases.html') -@app.route('/logs') -@login_required -def get_logs(): - - logs = [] - with io.open(os.path.join(args.config_dir, 'log', 'bazarr.log'), encoding='UTF-8') as file: - for line in file.readlines(): - lin = [] - lin = line.split('|') - logs.append(lin) - logs.reverse() - - return dict(data=logs) - - def configured(): database.execute("UPDATE system SET configured = 1") @@ -719,6 +707,7 @@ def api_movies_history(): return dict(subtitles=history_subs) +@app.route('/test_url', methods=['GET']) @app.route('/test_url//', methods=['GET']) @login_required def test_url(protocol, url): @@ -742,87 +731,10 @@ def test_notification(protocol, provider): apobj.notify( title='Bazarr test notification', - body=('Test notification') + body='Test notification' ) -@app.route('/notifications') -@login_required -def notifications(): - if queueconfig.notifications: - test = queueconfig.notifications - return queueconfig.notifications.read() or '' - else: - return abort(400) - - -@app.route('/running_tasks') -@login_required -def running_tasks_list(): - - return dict(tasks=scheduler.get_running_tasks()) - - -@app.route('/episode_history/') -@login_required -def episode_history(no): - - episode_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history " - "WHERE sonarrEpisodeId=? ORDER BY timestamp DESC", (no,)) - for item in episode_history: - item['timestamp'] = "
" + \ - pretty.date(datetime.fromtimestamp(item['timestamp'])) + "
" - if item['language']: - item['language'] = language_from_alpha2(item['language']) - else: - item['language'] = "undefined" - if item['score']: - item['score'] = str(round((int(item['score']) * 100 / 360), 2)) + "%" - - return dict(data=episode_history) - - -@app.route('/movie_history/') -@login_required -def movie_history(no): - - movie_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history_movie " - "WHERE radarrId=? ORDER BY timestamp DESC", (no,)) - for item in movie_history: - if item['action'] == 0: - item['action'] = "
" - elif item['action'] == 1: - item['action'] = "
" - elif item['action'] == 2: - item['action'] = "
" - elif item['action'] == 3: - item['action'] = "
" - elif item['action'] == 4: - item['action'] = "
" - - item['timestamp'] = "
" + \ - pretty.date(datetime.fromtimestamp(item['timestamp'])) + "
" - if item['language']: - item['language'] = language_from_alpha2(item['language']) - else: - item['language'] = "undefined" - if item['score']: - item['score'] = str(round((int(item['score']) * 100 / 120), 2)) + '%' - - return dict(data=movie_history) - - # Mute DeprecationWarning warnings.simplefilter("ignore", DeprecationWarning) # Mute Insecure HTTPS requests made to Sonarr and Radarr diff --git a/views/_main.html b/views/_main.html index 557aa23b3..3aab1b70b 100644 --- a/views/_main.html +++ b/views/_main.html @@ -187,7 +187,7 @@ diff --git a/views/settingsradarr.html b/views/settingsradarr.html index a0501a9e8..d7b13d94a 100644 --- a/views/settingsradarr.html +++ b/views/settingsradarr.html @@ -1,248 +1,380 @@ -
Connection settings
-
-
-
-
- -
-
- +{% extends '_main.html' %} + +{% block title %}Radarr - Bazarr{% endblock %} + +{% block page_head %} + +{% endblock page_head %} + +{% block bcleft %} +
+ +
+{% endblock bcleft %} + +{% block bcright %} + +{% endblock bcright %} + +{% block body %} +
+
+

Use Radarr

+
+
+
+ Enabled +
+
+
-
+
-
-
- -
-
-
-
- +
+

Host

+
+
+
+ Hostname or IP Address +
+
+
-
- - -
-
- -
-
-
-
- +
+
+
+ URL Base +
+
+
-
- - -
-
- -
-
-
- +
+
+ API Key +
+
+ +
-
- +
-
-
- -
-
-
- - +

Options

+
+
+
+ Minimum Score +
+
+ +
-
-
+
+
+
+ Download Only Monitored +
+
+ +
+
+
+

Path Mappings

+
+
+
+ -
-
- -
-
-
-
- +
+
-