From 21339dd5390707355d77b933c2073848354fe3bd Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sat, 11 Feb 2023 13:11:08 +0100 Subject: [PATCH] Re #1377 - Use year/date in the backup snapshot zip filename --- changedetectionio/__init__.py | 3 +- price-finder | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 price-finder diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index acc9b9f4..fea562e2 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -1036,7 +1036,8 @@ def changedetection_app(config=None, datastore_o=None): os.unlink(previous_backup_filename) # create a ZipFile object - backupname = "changedetection-backup-{}.zip".format(int(time.time())) + timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S") + backupname = "changedetection-backup-{}.zip".format(timestamp) backup_filepath = os.path.join(datastore_o.datastore_path, backupname) with zipfile.ZipFile(backup_filepath, "w", diff --git a/price-finder b/price-finder new file mode 100644 index 00000000..7c8d41c2 --- /dev/null +++ b/price-finder @@ -0,0 +1,55 @@ +diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py +index 475e90c5..843a273e 100644 +--- a/changedetectionio/content_fetcher.py ++++ b/changedetectionio/content_fetcher.py +@@ -122,6 +122,15 @@ class Fetcher(): + # Should set self.error, self.status_code and self.content + pass + ++ def restock_status(self): ++ x=1 ++ ++ def extracted_price(self): ++ x=1 ++ ++ def run_all_js_extractions(self): ++ x=1 ++ + @abstractmethod + def quit(self): + return +diff --git a/changedetectionio/fetch_site_status.py b/changedetectionio/fetch_site_status.py +index 04b57367..0ef63fbf 100644 +--- a/changedetectionio/fetch_site_status.py ++++ b/changedetectionio/fetch_site_status.py +@@ -199,6 +199,13 @@ class perform_site_check(): + if watch.get('track_ldjson_price_data', '') == PRICE_DATA_TRACK_ACCEPT: + include_filters_rule.append(html_tools.LD_JSON_PRODUCT_OFFER_SELECTOR) + ++ # maybe run them all in playwright, return it in the `fetcher` object ++ if watch.get('pluggable_logic_rules', []): ++ # Run some JS and parse it back through Python ++ # I think we want to empty the content and append a joined list of results from these processors ++ # ++ x=1 ++ + has_filter_rule = include_filters_rule and len("".join(include_filters_rule).strip()) + has_subtractive_selectors = subtractive_selectors and len(subtractive_selectors[0].strip()) + +diff --git a/changedetectionio/pluggable_filters/__init__.py b/changedetectionio/pluggable_filters/__init__.py +index e69de29b..e6f0d975 100644 +--- a/changedetectionio/pluggable_filters/__init__.py ++++ b/changedetectionio/pluggable_filters/__init__.py +@@ -0,0 +1,11 @@ ++class pluggable_js_filter(): ++ # Test it against the page, could be JS? means its possible to enable ++ def plugin_name(self): ++ return 'restock check' ++ ++ def could_be_active(self): ++ return False ++ ++ def get_value(self): ++ # ie "In-stock" "out-of-stock" ++ return '' +\ No newline at end of file