From 232bd92389e3bf9514b28e63e6029d8140f1ed9a Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 28 Jul 2022 10:16:19 +0200 Subject: [PATCH] Bug fix - Filter "Only trigger when new lines appear" should check all history, not only the first item (#777) --- changedetectionio/model/Watch.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index 87235b0a..b53688d3 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -172,13 +172,14 @@ class model(dict): # Iterate over all history texts and see if something new exists def lines_contain_something_unique_compared_to_history(self, lines=[]): - local_lines = [l.decode('utf-8').strip().lower() for l in lines] + local_lines = set([l.decode('utf-8').strip().lower() for l in lines]) # Compare each lines (set) against each history text file (set) looking for something new.. + existing_history = set({}) for k, v in self.history.items(): - alist = [line.decode('utf-8').strip().lower() for line in open(v, 'rb')] - res = set(alist) != set(local_lines) - if res: - return True + alist = set([line.decode('utf-8').strip().lower() for line in open(v, 'rb')]) + existing_history = existing_history.union(alist) - return False + # Check that everything in local_lines(new stuff) already exists in existing_history - it should + # if not, something new happened + return not local_lines.issubset(existing_history)