From 69892861a5e894b3188da8e3e347b7a2f929e86d Mon Sep 17 00:00:00 2001 From: KeksNino Date: Tue, 29 Jul 2025 19:53:41 +0200 Subject: [PATCH] added other files from main-cli --- core/downloading/aria2p_server.py | 21 +++++++++++++++++++++ core/downloading/download.py | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 core/downloading/aria2p_server.py create mode 100644 core/downloading/download.py diff --git a/core/downloading/aria2p_server.py b/core/downloading/aria2p_server.py new file mode 100644 index 0000000..01b513c --- /dev/null +++ b/core/downloading/aria2p_server.py @@ -0,0 +1,21 @@ +import aria2p +import os +import subprocess + + +def run_aria2p(): + + aria2 = aria2p.API( + aria2p.Client( + host="http://localhost", + port=6800, + secret="" + ) + ) + + + downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads") + subprocess.Popen(["aria2c", "--enable-rpc", "--rpc-listen-all=true", f"--dir={downloads_dir}"]) + + + return aria2 \ No newline at end of file diff --git a/core/downloading/download.py b/core/downloading/download.py new file mode 100644 index 0000000..0e9bdc2 --- /dev/null +++ b/core/downloading/download.py @@ -0,0 +1,19 @@ +from .aria2p_server import run_aria2p +import aria2p +import subprocess +import os +# from .scraper import uri +def start_client(): + global aria2 + aria2 = run_aria2p() + +def add_magnet(uri): + aria2.add_magnet(uri) + + +def terminate(): + return + + + +