used a drop down menu and rewrote checking code to fit GUI description

diff-proposed-for-bwees
bwees 2 years ago
parent 8ee42d2403
commit dc3fc6cfdf

@ -278,23 +278,18 @@ class perform_site_check():
logging.debug("check_unique_lines: UUID {} had unique content".format(uuid))
if changed_detected:
diff_filters = {
"add": watch.get('trigger_on_add', True),
"del": watch.get('trigger_on_del', True),
}
if False in diff_filters.values(): # if we are supposed to filter any diff types
print("Diff Filters Active: " + str(diff_filters))
if watch.get("trigger_type", "all") != "all": # 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))
# for each diff type, if the filter setting is false, and the diff type is present, then set the changed_detected to false
for diff_type in diff_types:
if not diff_filters[diff_type] and diff_types[diff_type]:
changed_detected = False
break # we only need to check one diff type
# Only Additions
if watch["trigger_type"] == "add" and not diff_types["add"] and diff_types["del"]:
changed_detected = False
# Only Deletions
elif watch["trigger_type"] == "delete" and not diff_types["del"] and diff_types["add"]:
changed_detected = False
# Always record the new checksum and the new text
update_obj["previous_md5"] = fetched_md5

@ -8,7 +8,6 @@ from wtforms import (
PasswordField,
RadioField,
SelectField,
SelectMultipleField,
StringField,
SubmitField,
TextAreaField,
@ -344,8 +343,7 @@ 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_on_add = BooleanField('Additions', default=True)
trigger_on_del = BooleanField('Deletions', default=True)
trigger_type = SelectField(u'Trigger On', choices=[("all", "Any Changes"), ("add", "Only Additions"), ("delete", "Only Deletions")], coerce=str, default="add")
webdriver_js_execute_code = TextAreaField('Execute JavaScript before change detection', render_kw={"rows": "5"}, validators=[validators.Optional()])

@ -43,8 +43,7 @@ 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_on_add': True, # Allow a trigger if there are additions from the last snapshot
'trigger_on_del': True, # Allow a trigger if there are deletions from the last snapshot
'trigger_type': "all",
'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

@ -157,13 +157,11 @@ User-Agent: wonderbra 1.0") }}
</div>
</fieldset>
<fieldset>
<div class="pure-control-group">
<label for="trigger-type">Trigger On</label>
{{ render_checkbox_field(form.trigger_on_add, class="trigger-type") }}
{{ render_checkbox_field(form.trigger_on_del, class="trigger-type") }}
<div class="pure-control-group" id="request-method">
{{ render_field(form.trigger_type) }}
<span class="pure-form-message-inline">
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 for only content being removed.
This is good for filtering out notifications that only are showing deleted content. (i.e A notice being removed from a website)
</span>
</div>
</fieldset>

Loading…
Cancel
Save