Files
SoftwareManager/core/downloading/aria2p_server.py
T

33 lines
620 B
Python

import aria2p
import os
import subprocess
def run_aria2p():
aria2 = aria2p.API(
aria2p.Client(
host="http://localhost",
port=6800,
secret=""
)
)
return aria2
def aria2server():
downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads")
cmd = [
"aria2c",
"--enable-rpc",
"--disable-ipv6", # added this since it caused problems with vpns
"--rpc-listen-all",
"--rpc-listen-port=6800",
f"--dir={downloads_dir}"
]
aria2server = subprocess.Popen(cmd)
return aria2server