diff --git a/changedetectionio/fetch_site_status.py b/changedetectionio/fetch_site_status.py
index 7a4f0a2e..b5eef3ab 100644
--- a/changedetectionio/fetch_site_status.py
+++ b/changedetectionio/fetch_site_status.py
@@ -225,25 +225,40 @@ class perform_site_check():
fetched_md5 = hashlib.md5(stripped_text_from_html).hexdigest()
############ Blocking rules, after checksum #################
- blocked_by_not_found_trigger_text = False
+ blocked = False
if len(watch['trigger_text']):
- # Yeah, lets block first until something matches
- blocked_by_not_found_trigger_text = True
+ # Assume blocked
+ blocked = True
# Filter and trigger works the same, so reuse it
# It should return the line numbers that match
result = html_tools.strip_ignore_text(content=str(stripped_text_from_html),
wordlist=watch['trigger_text'],
mode="line numbers")
- # If it returned any lines that matched..
+ # Unblock if the trigger was found
if result:
- blocked_by_not_found_trigger_text = False
+ blocked = False
- if not blocked_by_not_found_trigger_text and watch['previous_md5'] != fetched_md5:
+
+ if len(watch['text_should_not_be_present']):
+ # If anything matched, then we should block a change from happening
+ result = html_tools.strip_ignore_text(content=str(stripped_text_from_html),
+ wordlist=watch['text_should_not_be_present'],
+ mode="line numbers")
+ if result:
+ blocked = True
+
+ # The main thing that all this at the moment comes down to :)
+ if watch['previous_md5'] != fetched_md5:
changed_detected = True
+ # Looks like something changed, but did it match all the rules?
+ if blocked:
+ changed_detected = False
+ else:
update_obj["last_changed"] = timestamp
+
# Extract title as title
if is_html:
if self.datastore.data['settings']['application']['extract_title_as_title'] or watch['extract_title_as_title']:
@@ -257,5 +272,4 @@ class perform_site_check():
if not watch.get('previous_md5'):
watch['previous_md5'] = fetched_md5
-
return changed_detected, update_obj, text_content_before_ignored_filter, fetcher.screenshot, fetcher.xpath_data
diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py
index 4b672cb2..dc6f3082 100644
--- a/changedetectionio/forms.py
+++ b/changedetectionio/forms.py
@@ -341,6 +341,8 @@ class watchForm(commonSettingsForm):
method = SelectField('Request method', choices=valid_method, default=default_method)
ignore_status_codes = BooleanField('Ignore status codes (process non-2xx status codes as normal)', 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()])
+
save_button = SubmitField('Save', render_kw={"class": "pure-button pure-button-primary"})
save_and_preview_button = SubmitField('Save & Preview', render_kw={"class": "pure-button pure-button-primary"})
proxy = RadioField('Proxy')
diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py
index f55ffce0..64f299fd 100644
--- a/changedetectionio/model/Watch.py
+++ b/changedetectionio/model/Watch.py
@@ -38,6 +38,7 @@ class model(dict):
'extract_text': [], # Extract text by regex after filters
'subtractive_selectors': [],
'trigger_text': [], # List of text or regex to wait for until a change is detected
+ 'text_should_not_be_present': [], # Text that should not present
'fetch_backend': None,
'extract_title_as_title': False,
'proxy': None, # Preferred proxy connection
@@ -85,7 +86,7 @@ class model(dict):
# Read the history file as a dict
fname = os.path.join(self.__datastore_path, self.get('uuid'), "history.txt")
if os.path.isfile(fname):
- logging.debug("Disk IO accessed " + str(time.time()))
+ logging.debug("Reading history index " + str(time.time()))
with open(fname, "r") as f:
tmp_history = dict(i.strip().split(',', 2) for i in f.readlines())
diff --git a/changedetectionio/run_all_tests.sh b/changedetectionio/run_all_tests.sh
index 625429c7..c2bbf9aa 100755
--- a/changedetectionio/run_all_tests.sh
+++ b/changedetectionio/run_all_tests.sh
@@ -9,8 +9,6 @@
# exit when any command fails
set -e
-export MINIMUM_SECONDS_RECHECK_TIME=0
-
find tests/test_*py -type f|while read test_name
do
echo "TEST RUNNING $test_name"
diff --git a/changedetectionio/store.py b/changedetectionio/store.py
index 4c020515..fca06438 100644
--- a/changedetectionio/store.py
+++ b/changedetectionio/store.py
@@ -290,14 +290,15 @@ class ChangeDetectionStore:
headers={'App-Guid': self.__data['app_guid']})
res = r.json()
- # List of permisable stuff we accept from the wild internet
+ # List of permissible attributes we accept from the wild internet
for k in ['url', 'tag',
- 'paused', 'title',
- 'previous_md5', 'headers',
- 'body', 'method',
- 'ignore_text', 'css_filter',
- 'subtractive_selectors', 'trigger_text',
- 'extract_title_as_title', 'extract_text']:
+ 'paused', 'title',
+ 'previous_md5', 'headers',
+ 'body', 'method',
+ 'ignore_text', 'css_filter',
+ 'subtractive_selectors', 'trigger_text',
+ 'extract_title_as_title', 'extract_text',
+ 'text_should_not_be_present']:
if res.get(k):
apply_extras[k] = res[k]
diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html
index 009f6ad0..6a72153c 100644
--- a/changedetectionio/templates/edit.html
+++ b/changedetectionio/templates/edit.html
@@ -199,6 +199,22 @@ nav
+