mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
partial fix: fix function call for download progress
This commit is contained in:
@@ -5,9 +5,8 @@ from plyer import notification
|
||||
import time
|
||||
|
||||
def run_aria2p():
|
||||
global aria2
|
||||
|
||||
aria2 = aria2p.API(
|
||||
state.aria2 = aria2p.API(
|
||||
aria2p.Client(
|
||||
host="http://localhost",
|
||||
port=6800,
|
||||
@@ -15,7 +14,7 @@ def run_aria2p():
|
||||
)
|
||||
)
|
||||
|
||||
return aria2
|
||||
return state.aria2
|
||||
|
||||
|
||||
def aria2server():
|
||||
@@ -39,7 +38,7 @@ def aria2server():
|
||||
|
||||
def dlprogress():
|
||||
try:
|
||||
downloads = aria2.get_downloads()
|
||||
downloads = state.aria2.get_downloads()
|
||||
if downloads:
|
||||
for download in downloads:
|
||||
progress = download.progress_string(0)
|
||||
@@ -52,7 +51,7 @@ def dlprogress():
|
||||
def send_notification():
|
||||
while True:
|
||||
try:
|
||||
downloads = aria2.get_downloads()
|
||||
downloads = state.aria2.get_downloads()
|
||||
if downloads:
|
||||
for download in downloads:
|
||||
if download.is_complete:
|
||||
|
||||
@@ -13,6 +13,7 @@ class AppState:
|
||||
download_path: str = str(Path.home() / "Downloads")
|
||||
speed_limit: int = 0
|
||||
aria2process: Optional[Any] = None
|
||||
aria2: Optional[Any] = None
|
||||
aria2_threads: int = 4
|
||||
|
||||
state = AppState(posts=[], post_titles=[], post_urls=[], download_path="")
|
||||
|
||||
@@ -26,7 +26,6 @@ def run_gui():
|
||||
sys.exit(app.exec())
|
||||
|
||||
def run_aria2server():
|
||||
run_thread(threading.Thread(target=send_notification))
|
||||
aria2process = aria2server()
|
||||
return aria2process
|
||||
|
||||
@@ -48,6 +47,7 @@ if __name__ == "__main__":
|
||||
if state.debug:
|
||||
print("Starting Aria2 Server")
|
||||
state.aria2process = run_aria2server()
|
||||
run_thread(threading.Thread(target=send_notification))
|
||||
signal.signal(signal.SIGINT, keyboardinterrupthandler)
|
||||
atexit.register(kill_aria2server)
|
||||
if state.debug:
|
||||
|
||||
Reference in New Issue
Block a user