diff --git a/bazarr/api.py b/bazarr/api.py index e8dbb2ea6..e0fff003d 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -124,6 +124,7 @@ class Notifications(Resource): database.execute("UPDATE table_settings_notifier SET enabled = ?, url = ? WHERE name = ?", (item['enabled'], item['url'], item['name'])) + save_settings(zip(request.form.keys(), request.form.listvalues())) return '', 204 @@ -606,7 +607,8 @@ class EpisodesSubtitlesManualDownload(Resource): subs_id = result[6] subs_path = result[7] history_log(2, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score, subs_id, subs_path) - send_notifications(sonarrSeriesId, sonarrEpisodeId, message) + if not settings.general.getboolean('dont_notify_manual_actions'): + send_notifications(sonarrSeriesId, sonarrEpisodeId, message) store_subtitles(path, episodePath) return result, 201 except OSError: @@ -653,7 +655,8 @@ class EpisodesSubtitlesUpload(Resource): provider = "manual" score = 360 history_log(4, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score, subtitles_path=subs_path) - send_notifications(sonarrSeriesId, sonarrEpisodeId, message) + if not settings.general.getboolean('dont_notify_manual_actions'): + send_notifications(sonarrSeriesId, sonarrEpisodeId, message) store_subtitles(path, episodePath) return result, 201 @@ -1057,7 +1060,8 @@ class MovieSubtitlesManualDownload(Resource): subs_id = result[6] subs_path = result[7] history_log_movie(2, radarrId, message, path, language_code, provider, score, subs_id, subs_path) - send_notifications_movie(radarrId, message) + if not settings.general.getboolean('dont_notify_manual_actions'): + send_notifications_movie(radarrId, message) store_subtitles_movie(path, moviePath) return result, 201 except OSError: @@ -1103,7 +1107,8 @@ class MovieSubtitlesUpload(Resource): provider = "manual" score = 120 history_log_movie(4, radarrId, message, path, language_code, provider, score, subtitles_path=subs_path) - send_notifications_movie(radarrId, message) + if not settings.general.getboolean('dont_notify_manual_actions'): + send_notifications_movie(radarrId, message) store_subtitles_movie(path, moviePath) return result, 201 diff --git a/bazarr/config.py b/bazarr/config.py index 3f1275bd4..b266280a2 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -59,7 +59,8 @@ defaults = { 'anti_captcha_provider': 'None', 'wanted_search_frequency': '3', 'wanted_search_frequency_movie': '3', - 'subzero_mods': '' + 'subzero_mods': '', + 'dont_notify_manual_actions': 'False' }, 'auth': { 'type': 'None', diff --git a/views/settingsnotifications.html b/views/settingsnotifications.html index 82bc49da9..e34355855 100644 --- a/views/settingsnotifications.html +++ b/views/settingsnotifications.html @@ -48,6 +48,22 @@ +
+

Options

+
+
+
+ Do not notify for manual actions +
+
+ + +
+
@@ -120,6 +136,9 @@ $('#save_button_checkmark').hide(); $('#save_button').prop('disabled', true).css('cursor', 'not-allowed'); + // Set Checkbox input values + $('#settings-general-dont_notify_manual_actions').prop('checked', {{'true' if settings.general.getboolean('dont_notify_manual_actions') else 'false'}}); + var table = $('#notification_providers').DataTable({ select: { style: 'single' @@ -192,6 +211,11 @@ $('#save_button').on('click', function() { var formdata = new FormData(document.getElementById("settings_form")); + // Make sure all checkbox input are sent with true/false value + $('input[type=checkbox]').each(function () { + formdata.set($(this).prop('id'), $(this).prop('checked')); + }); + formdata.append('notification_providers', JSON.stringify(table.rows().data().toArray())); $.ajax({