diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index 895fc738..86866feb 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -108,6 +108,9 @@ select.form-control { text-transform: uppercase; font-size: 10px; } +.react-selectize.root-node .react-selectize-control .react-selectize-search-field-and-selected-values.negative-operator .value-wrapper:not(:first-child):before { + content: "and" !important; +} .react-selectize.root-node .react-selectize-control .react-selectize-search-field-and-selected-values .resizable-input { padding-top: 3px !important; padding-bottom: 3px !important; diff --git a/data/interfaces/default/notifier_config.html b/data/interfaces/default/notifier_config.html index e96c3220..d99e1c37 100644 --- a/data/interfaces/default/notifier_config.html +++ b/data/interfaces/default/notifier_config.html @@ -342,7 +342,22 @@ $('#custom_conditions').val(JSON.stringify(newConditions)); } }); + + function setNegativeOperator(select) { + if (select.val() === 'does not contain' || select.val() === 'is not') { + select.closest('.form-group').find('.react-selectize-search-field-and-selected-values').addClass('negative-operator'); + } else { + select.closest('.form-group').find('.react-selectize-search-field-and-selected-values').removeClass('negative-operator'); + } + } + $('#condition-widget select[name=operator]').each(function () { + setNegativeOperator($(this)); + }); + $('#condition-widget').on('change', 'select[name=operator]', function () { + setNegativeOperator($(this)); + }); + function reloadModal() { $.ajax({ url: 'get_notifier_config_modal', diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index eeb5e5b2..d8acbce4 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -277,13 +277,13 @@ def notify_custom_conditions(notifier_id=None, parameters=None): evaluated_conditions.append(any(c in parameter_value for c in values)) elif operator == 'does not contain': - evaluated_conditions.append(any(c not in parameter_value for c in values)) + evaluated_conditions.append(all(c not in parameter_value for c in values)) elif operator == 'is': evaluated_conditions.append(any(parameter_value == c for c in values)) elif operator == 'is not': - evaluated_conditions.append(any(parameter_value != c for c in values)) + evaluated_conditions.append(all(parameter_value != c for c in values)) elif operator == 'begins with': evaluated_conditions.append(parameter_value.startswith(tuple(values)))