mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +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="")
|
||||
|
||||
Reference in New Issue
Block a user