diff --git a/changedetectionio/fetch_site_status.py b/changedetectionio/fetch_site_status.py index 44baa1d6c..2cf6639b7 100644 --- a/changedetectionio/fetch_site_status.py +++ b/changedetectionio/fetch_site_status.py @@ -277,18 +277,19 @@ class perform_site_check(): else: logging.debug("check_unique_lines: UUID {} had unique content".format(uuid)) + print(watch.get("trigger_add"), watch.get("trigger_del")) if changed_detected: - if watch.get("trigger_type", "all") != "all": # if we are supposed to filter any diff types + if not watch.get("trigger_add", True) or not watch.get("trigger_del", True): # if we are supposed to filter any diff types # get the diff types present in the watch diff_types = watch.get_diff_types(text_content_before_ignored_filter) print("Diff components found: " + str(diff_types)) - # Only Additions - if watch["trigger_type"] == "add" and not diff_types["add"] and diff_types["del"]: + # Only Additions (deletions are turned off) + if not watch["trigger_del"] and diff_types["del"] and not diff_types["add"]: changed_detected = False - # Only Deletions - elif watch["trigger_type"] == "delete" and not diff_types["del"] and diff_types["add"]: + # Only Deletions (additions are turned off) + elif not watch["trigger_add"] and not diff_types["add"] and diff_types["del"]: changed_detected = False # Always record the new checksum and the new text diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index ad349113d..00d2e4fef 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -343,7 +343,8 @@ class watchForm(commonSettingsForm): check_unique_lines = BooleanField('Only trigger when new lines appear', default=False) trigger_text = StringListField('Trigger/wait for text', [validators.Optional(), ValidateListRegex()]) text_should_not_be_present = StringListField('Block change-detection if text matches', [validators.Optional(), ValidateListRegex()]) - trigger_type = SelectField(u'Trigger On', choices=[("all", "Any Changes"), ("add", "Only Additions"), ("delete", "Only Deletions")], coerce=str, default="add") + trigger_add = BooleanField('Additions', default=True) + trigger_del = BooleanField('Deletions', default=True) webdriver_js_execute_code = TextAreaField('Execute JavaScript before change detection', render_kw={"rows": "5"}, validators=[validators.Optional()]) diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index 47d85b3d8..0352742db 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -42,7 +42,8 @@ class model(dict): 'fetch_backend': None, 'extract_title_as_title': False, 'check_unique_lines': False, # On change-detected, compare against all history if its something new - 'trigger_type': "all", + 'trigger_add': True, + 'trigger_del': True, 'proxy': None, # Preferred proxy connection # Re #110, so then if this is set to None, we know to use the default value instead # Requires setting to None on submit if it's the same as the default diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 0398b0a83..f641c8f88 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -157,11 +157,12 @@ User-Agent: wonderbra 1.0") }}
-
- {{ render_field(form.trigger_type) }} +
+ + {{ render_checkbox_field(form.trigger_add, class="trigger-type") }} + {{ render_checkbox_field(form.trigger_del, class="trigger-type") }} - This filter only compares to the previous snapshot. This is different from the "Only trigger when new lines appear" setting which checks all previous snapshots.
- This is good for filtering out notifications that only are showing deleted content. (i.e A notice being removed from a website)
+ Limits the change-detection of this watch to only this content