mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
29 lines
946 B
Python
29 lines
946 B
Python
from core.utils.data.state import state
|
|
from core.utils.general.shutdown import kill_aria2server
|
|
from .config import create_config
|
|
|
|
def restart_aria2c():
|
|
import main # had to do this because of circle import :(
|
|
import signal
|
|
import atexit
|
|
kill_aria2server()
|
|
state.aria2process.wait()
|
|
state.aria2process = main.run_aria2server()
|
|
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
|
|
atexit.unregister(kill_aria2server)
|
|
atexit.register(kill_aria2server)
|
|
|
|
def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_path=None, speed_limit=None):
|
|
if thread_count is not None:
|
|
state.aria2_threads = thread_count
|
|
if apiurl is not None:
|
|
state.api_url = apiurl
|
|
if download_path is not None:
|
|
state.download_path = download_path
|
|
if speed_limit is not None:
|
|
state.speed_limit = speed_limit
|
|
|
|
create_config()
|
|
restart_aria2c()
|
|
close()
|