Update everything to work with new API + Reorganize file structurem functions and common logic

This commit is contained in:
Vxrtrauter
2025-10-09 22:12:10 +02:00
parent 53b2bb912e
commit 62b8506d13
7 changed files with 64 additions and 56 deletions
+16 -3
View File
@@ -1,17 +1,30 @@
from core.utils.data.state import state
from core.utils.data.tracker import get_item_index
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
import threading
def download_selected(item, ):
def download_selected(item, posts, post_titles):
if item is not None:
if state.debug:
print(f"network {item.text()}")
run_thread(threading.Thread(target=get_item_index, args=(item.text(), self.postnames, self.postlinks, state.debug)))
run_thread(threading.Thread(target=run_download, args=(item.text(), posts, post_titles)))
else:
if state.debug:
print("No item selected for download.")
def run_download(item, posts, post_titles):
post_url = get_item_url(item, posts, post_titles)
if state.debug:
print("Selected URL: ", post_url)
magnet_uri = get_magnet_link(post_url)
start_client()
add_magnet(magnet_uri)
+14 -6
View File
@@ -1,10 +1,18 @@
def split_data(data):
json = json.loads(data)
import json
count = json["count"]
posts = json["data"]
query = json["query"]
success = json["success"]
def split_data(data):
p_json = json.loads(data)
count = p_json["count"]
posts = p_json["data"]
query = p_json["query"]
success = p_json["success"]
return count, posts, query, success
def format_data(data):
post_titles = [post["title"] for post in data]
post_links = [post["url"] for post in data]
return post_titles, post_links