refractor files and improve aria2 process killing, needs improvement

This commit is contained in:
Vxrtrauter
2025-10-11 23:52:25 +02:00
parent 251f9f40de
commit f358d5462f
7 changed files with 31 additions and 19 deletions
+1
View File
@@ -15,6 +15,7 @@ class AppState:
speed_limit: int = 0
aria2process: Optional[Any] = None
aria2: Any = None
aria2p: Any = None
aria2_threads: int = 4
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], download_path="")
+16
View File
@@ -0,0 +1,16 @@
from core.utils.data.state import state
import threading
shutdown_event = threading.Event()
def kill_aria2server():
if state.aria2process:
state.aria2process.kill()
if state.debug:
print("\nKilled Aria2")
def closehelper():
shutdown_event.set()
kill_aria2server()
+1 -1
View File
@@ -3,7 +3,7 @@ from core.utils.data.tracker import get_item_url
from core.utils.data.tracker import get_magnet_link
from core.network.aria2_wrapper import start_client
from core.network.aria2_wrapper import add_magnet
from core.utils.wrappers import run_thread
from core.utils.general.wrappers import run_thread
import threading