mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 01:49:42 +02:00
refractor files and improve aria2 process killing, needs improvement
This commit is contained in:
@@ -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="")
|
||||
|
||||
@@ -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()
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user