From 6d0ccfd8780256118d573e60f35973e444e251e7 Mon Sep 17 00:00:00 2001 From: "ellipsis-dev[bot]" <65095814+ellipsis-dev[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 12:37:51 +0000 Subject: [PATCH] address comments left by @ErikBjare on #99 ([Feature] Add `exclude_titles` feature for enhanced window title exclusion); --- aw_watcher_window/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/aw_watcher_window/main.py b/aw_watcher_window/main.py index 6161992..c3c133a 100644 --- a/aw_watcher_window/main.py +++ b/aw_watcher_window/main.py @@ -23,7 +23,6 @@ if log_level: logger.setLevel(logging.__getattribute__(log_level.upper())) - def kill_process(pid): logger.info("Killing process {}".format(pid)) try: @@ -31,7 +30,6 @@ def kill_process(pid): except ProcessLookupError: logger.info("Process {} already dead".format(pid)) - def main(): args = parse_args() @@ -93,10 +91,9 @@ def main(): poll_time=args.poll_time, strategy=args.strategy, exclude_title=args.exclude_title, - exclude_titles=[re.compile(re.escape(title), re.IGNORECASE) for title in args.exclude_titles] + exclude_titles=[try: re.compile(title, re.IGNORECASE) except re.error: re.compile(re.escape(title), re.IGNORECASE) for title in args.exclude_titles] ) - def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False, exclude_titles=[]): while True: if os.getppid() == 1: @@ -147,4 +144,4 @@ def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False, bucket_id, current_window_event, pulsetime=poll_time + 1.0, queued=True ) - sleep(poll_time) + sleep(poll_time) \ No newline at end of file