From e4c50e20df5a1610bbe30c55a5aba712d66cf914 Mon Sep 17 00:00:00 2001 From: KeksNino Date: Sat, 11 Oct 2025 15:31:31 +0200 Subject: [PATCH] fixed notifications (kinda) --- core/network/aria2_integration.py | 15 ++++++--------- core/utils/data/tracker.py | 2 +- main.py | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/network/aria2_integration.py b/core/network/aria2_integration.py index 627b011..414cf90 100644 --- a/core/network/aria2_integration.py +++ b/core/network/aria2_integration.py @@ -50,17 +50,14 @@ def dlprogress(): def send_notification(): while True: - if state.aria2 is None: - time.sleep(1) - continue - try: for d in state.aria2.get_downloads(): - if d.is_complete: - notification.notify( - title="Download finished", - message=d.name, - timeout=4) + if dlprogress() == 100: + notification.notify( + title="Download finished", + message=f"{d.name} has finished downloading.", + timeout=4 + ) except Exception as e: if state.debug: print("Notification thread error:", e) diff --git a/core/utils/data/tracker.py b/core/utils/data/tracker.py index d51d991..247abb6 100644 --- a/core/utils/data/tracker.py +++ b/core/utils/data/tracker.py @@ -13,7 +13,7 @@ def get_item_url(item, posts, post_titles): # oftwarelist currentitem, post list return item if state.tracker == "rutracker": item_dict = posts[post_index] - _, post_links = format_data([item_dict]) + _, post_links, _ = format_data([item_dict]) return post_links[0] return None diff --git a/main.py b/main.py index 6066907..8648074 100644 --- a/main.py +++ b/main.py @@ -49,7 +49,7 @@ if __name__ == "__main__": state.aria2process = run_aria2server() signal.signal(signal.SIGINT, keyboardinterrupthandler) atexit.register(kill_aria2server) - # run_thread(threading.Thread(target=send_notification)) + run_thread(threading.Thread(target=send_notification)) if state.debug: print("Launching GUI") run_gui()