From d24111f3a60af12e03f1972096a09abd0f726e29 Mon Sep 17 00:00:00 2001 From: Brandon Wees Date: Thu, 27 Oct 2022 10:52:20 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: dgtlmoon --- changedetectionio/model/Watch.py | 3 +-- changedetectionio/store.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index b0d89500..3191c113 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -208,7 +208,7 @@ class model(dict): if not os.path.isdir(output_path): os.mkdir(output_path) - snapshot_fname = os.path.join(output_path, "previous.txt") + snapshot_fname = os.path.join(self.watch_data_dir, "previous.txt") logging.debug("Saving previous text {}".format(snapshot_fname)) with open(snapshot_fname, 'wb') as f: @@ -220,7 +220,6 @@ class model(dict): def get_previous_text(self): from os import path - output_path = os.path.join(self.__datastore_path, self['uuid']) snapshot_fname = os.path.join(output_path, "previous.txt") if self.history_n < 1: diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 4857bcf2..95c3c2b5 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -598,9 +598,9 @@ class ChangeDetectionStore: # Check if the previous.txt exists - if not os.path.exists(os.path.join(self.datastore_path, uuid, "previous.txt")): + if not os.path.exists(os.path.join(watch.watch_data_dir, "previous.txt")): # Generate a previous.txt - with open(os.path.join(self.datastore_path, uuid, "previous.txt"), "wb") as f: + with open(os.path.join(watch.watch_data_dir, "previous.txt"), "wb") as f: # Fill it with the latest history latest_file_name = watch.history[watch.newest_history_key] with open(latest_file_name, "rb") as f2: