mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
fixed notifications (kinda)
This commit is contained in:
@@ -50,17 +50,14 @@ def dlprogress():
|
|||||||
|
|
||||||
def send_notification():
|
def send_notification():
|
||||||
while True:
|
while True:
|
||||||
if state.aria2 is None:
|
|
||||||
time.sleep(1)
|
|
||||||
continue
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for d in state.aria2.get_downloads():
|
for d in state.aria2.get_downloads():
|
||||||
if d.is_complete:
|
if dlprogress() == 100:
|
||||||
notification.notify(
|
notification.notify(
|
||||||
title="Download finished",
|
title="Download finished",
|
||||||
message=d.name,
|
message=f"{d.name} has finished downloading.",
|
||||||
timeout=4)
|
timeout=4
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if state.debug:
|
if state.debug:
|
||||||
print("Notification thread error:", e)
|
print("Notification thread error:", e)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def get_item_url(item, posts, post_titles): # oftwarelist currentitem, post list
|
|||||||
return item
|
return item
|
||||||
if state.tracker == "rutracker":
|
if state.tracker == "rutracker":
|
||||||
item_dict = posts[post_index]
|
item_dict = posts[post_index]
|
||||||
_, post_links = format_data([item_dict])
|
_, post_links, _ = format_data([item_dict])
|
||||||
return post_links[0]
|
return post_links[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ if __name__ == "__main__":
|
|||||||
state.aria2process = run_aria2server()
|
state.aria2process = run_aria2server()
|
||||||
signal.signal(signal.SIGINT, keyboardinterrupthandler)
|
signal.signal(signal.SIGINT, keyboardinterrupthandler)
|
||||||
atexit.register(kill_aria2server)
|
atexit.register(kill_aria2server)
|
||||||
# run_thread(threading.Thread(target=send_notification))
|
run_thread(threading.Thread(target=send_notification))
|
||||||
if state.debug:
|
if state.debug:
|
||||||
print("Launching GUI")
|
print("Launching GUI")
|
||||||
run_gui()
|
run_gui()
|
||||||
|
|||||||
Reference in New Issue
Block a user