improved debug output

This commit is contained in:
Vxrtrauter
2025-10-16 15:49:00 +02:00
parent 3f6889da56
commit 999c8e9ba4
4 changed files with 15 additions and 3 deletions
+5
View File
@@ -1,11 +1,16 @@
from .aria2_integration import run_aria2p
from core.utils.data.state import state
def start_client():
global aria2
aria2 = run_aria2p()
if state.debug:
print("Started Aria2p")
def add_magnet(uri):
aria2.add_magnet(uri)
if state.debug:
print("Magnet URI added to Aria2")
+8 -1
View File
@@ -5,16 +5,21 @@ from core.utils.network.jsonhandler import format_data
def get_item_url(item, posts, post_titles): # oftwarelist currentitem, post list (dict), post titles list
def get_item_url(item, posts, post_titles): # softwarelist currentitem, post list (dict), post titles list
post_index = post_titles.index(item)
if 0 <= post_index < len(post_titles):
if state.tracker == "uztracker":
item = "https://uztracker.net/" + state.post_urls[post_index].lstrip("./")
if state.debug:
print("Found post URL: ", item)
return item
if state.tracker == "rutracker":
item_dict = posts[post_index]
_, post_links, _ = format_data([item_dict])
if state.debug:
print("Found post URL: ", post_links[0])
return post_links[0]
return None
@@ -22,6 +27,8 @@ def get_item_url(item, posts, post_titles): # oftwarelist currentitem, post list
def get_magnet_link(post_url):
try:
response = requests.get(post_url) # eventually impl. cloudscraper
if state.debug:
print("Sent Request to retrieve Magnet Link...")
response.raise_for_status()
soup = BeautifulSoup(response.text, 'html.parser')
magnet_link = soup.find('a', href=lambda x: x and x.startswith('magnet:'))
+1 -1
View File
@@ -22,7 +22,7 @@ def kill_aria2server():
if proc.name() == process:
proc.kill()
if state.debug:
print("Killed Aria2c")
print(f"Killed Aria2c (PID {proc.pid})")
except psutil.NoSuchProcess:
pass
+1 -1
View File
@@ -10,7 +10,7 @@ import threading
def download_selected(item, posts, post_titles):
if item is not None:
if state.debug:
print(f"network {item.text()}")
print(f"Downloading {item.text()}")
run_thread(threading.Thread(target=run_download, args=(item.text(), posts, post_titles)))
else: