diff --git a/bazarr/api.py b/bazarr/api.py index 71f8f8ce0..1d747b2b8 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -11,6 +11,7 @@ from operator import itemgetter import platform import io import re +import json from get_args import args from config import settings, base_url, save_settings @@ -98,6 +99,22 @@ class Languages(Resource): return jsonify(result) +class Notifications(Resource): + @authenticate + def get(self): + result = database.execute("SELECT * FROM table_settings_notifier ORDER BY name") + return jsonify(data=result) + + @authenticate + def post(self): + notification_providers = json.loads(request.form.get('notification_providers')) + for item in notification_providers: + database.execute("UPDATE table_settings_notifier SET enabled = ?, url = ? WHERE name = ?", + (item['enabled'], item['url'], item['name'])) + + return '', 204 + + class Search(Resource): @authenticate def get(self): @@ -1246,6 +1263,7 @@ api.add_resource(Restart, '/restart') api.add_resource(Badges, '/badges') api.add_resource(Languages, '/languages') +api.add_resource(Notifications, '/notifications') api.add_resource(Search, '/search_json') diff --git a/bazarr/main.py b/bazarr/main.py index c19977fe4..5ade8af14 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -355,6 +355,18 @@ def settingsproviders(): return render_template('settingsproviders.html') +@app.route('/settings/notifications/') +@login_required +def settingsnotifications(): + return render_template('settingsnotifications.html') + + +@app.route('/settings/scheduler/') +@login_required +def settingsscheduler(): + return render_template('settingsscheduler.html') + + @app.route('/check_update') @login_required def check_update(): diff --git a/views/_main.html b/views/_main.html index 0c13cb244..54f4e604f 100644 --- a/views/_main.html +++ b/views/_main.html @@ -206,8 +206,8 @@