From b1cc37e5fd8242d901d7f37c7c1cb88d2ac6c618 Mon Sep 17 00:00:00 2001 From: nille02 Date: Tue, 7 Jan 2025 15:01:42 +0100 Subject: [PATCH] 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()