From b1cc37e5fd8242d901d7f37c7c1cb88d2ac6c618 Mon Sep 17 00:00:00 2001 From: nille02 Date: Tue, 7 Jan 2025 15:01:42 +0100 Subject: [PATCH 1/2] Add option to preserve ids that are provided as arguments with --prepare-jobs If you try to combine --prepare-jobs and running Job IDs in one command the ids got ignores since prepare_jobs overrides the set. With this small change we use a set instead of a list we use a set and merge them later together to preserve other scheduled jobs. --- lib/urlwatch/command.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/urlwatch/command.py b/lib/urlwatch/command.py index 53d259fc..6a727de8 100644 --- a/lib/urlwatch/command.py +++ b/lib/urlwatch/command.py @@ -143,15 +143,15 @@ def test_filter(self, id): return 0 def prepare_jobs(self): - new_jobs = [] + new_jobs = {*()} for idx, job in enumerate(self.urlwatcher.jobs): has_history = self.urlwatcher.cache_storage.has_history_data(job.get_guid()) if not has_history: logger.info('Add Job: %s', job.pretty_name()) - new_jobs.append(idx + 1) - if not new_jobs: + new_jobs.add(idx + 1) + if not new_jobs and not self.urlwatch_config.idx_set: return 0 - self.urlwatch_config.idx_set = frozenset(new_jobs) + self.urlwatch_config.idx_set = self.urlwatch_config.idx_set.union(new_jobs) self.urlwatcher.run_jobs() self.urlwatcher.close() From c52d06027469cd0d9a6389b0d29f7e69461f28ca Mon Sep 17 00:00:00 2001 From: nille02 Date: Fri, 10 Jan 2025 09:45:50 +0100 Subject: [PATCH 2/2] Update lib/urlwatch/command.py Replace a "literal" with a function call. Co-authored-by: Thomas Perl --- lib/urlwatch/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlwatch/command.py b/lib/urlwatch/command.py index 6a727de8..cdafbbd6 100644 --- a/lib/urlwatch/command.py +++ b/lib/urlwatch/command.py @@ -143,7 +143,7 @@ def test_filter(self, id): return 0 def prepare_jobs(self): - new_jobs = {*()} + new_jobs = set() for idx, job in enumerate(self.urlwatcher.jobs): has_history = self.urlwatcher.cache_storage.has_history_data(job.get_guid()) if not has_history: