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