Simplify the logic around screenshot

This commit is contained in:
dgtlmoon
2022-11-20 09:44:29 +01:00
parent f066a1c38f
commit addd9a38e5
3 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -248,7 +248,8 @@ class model(dict):
if os.path.isfile(fname):
return fname
return False
# False is not an option for AppRise, must be type None
return None
def __get_file_ctime(self, filename):
fname = os.path.join(self.watch_data_dir, filename)
+1 -1
View File
@@ -103,7 +103,7 @@ def process_notification(n_object, datastore):
body=n_body,
body_format=n_format,
# False is not an option for AppRise, must be type None
attach=None if not n_object.get('screenshot') else n_object.get('screenshot')
attach=n_object.get('screenshot', None)
)
apobj.clear()
+2 -2
View File
@@ -74,7 +74,7 @@ class update_worker(threading.Thread):
n_object.update({
'watch_url': watch['url'],
'uuid': watch_uuid,
'screenshot': watch.get_screenshot() if watch.get('notification_screenshot') else False,
'screenshot': watch.get_screenshot(),
'current_snapshot': snapshot_contents.decode('utf-8'),
'diff': diff.render_diff(watch_history[dates[-2]], watch_history[dates[-1]], line_feed_sep=line_feed_sep),
'diff_full': diff.render_diff(watch_history[dates[-2]], watch_history[dates[-1]], True, line_feed_sep=line_feed_sep)
@@ -108,7 +108,7 @@ class update_worker(threading.Thread):
n_object.update({
'watch_url': watch['url'],
'uuid': watch_uuid,
'screenshot': False
'screenshot': None
})
self.notification_q.put(n_object)
print("Sent filter not found notification for {}".format(watch_uuid))