diff --git a/core/network/aria2_wrapper.py b/core/network/aria2_wrapper.py index c3be92c..9bf5d8b 100644 --- a/core/network/aria2_wrapper.py +++ b/core/network/aria2_wrapper.py @@ -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") diff --git a/core/utils/data/tracker.py b/core/utils/data/tracker.py index 27e7f27..dbd5090 100644 --- a/core/utils/data/tracker.py +++ b/core/utils/data/tracker.py @@ -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:')) diff --git a/core/utils/general/shutdown.py b/core/utils/general/shutdown.py index 38bf9fe..7642e4f 100644 --- a/core/utils/general/shutdown.py +++ b/core/utils/general/shutdown.py @@ -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 diff --git a/core/utils/network/download.py b/core/utils/network/download.py index 9c6f719..dbf7ef5 100644 --- a/core/utils/network/download.py +++ b/core/utils/network/download.py @@ -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: