fixed error messages spamming in console + added debug messages

This commit is contained in:
Vxrtrauter
2025-10-11 20:35:21 +02:00
parent e4c50e20df
commit a9450435d7
5 changed files with 13 additions and 9 deletions
+3 -1
View File
@@ -259,12 +259,14 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.softwareList.addItems(state.post_titles) self.softwareList.addItems(state.post_titles)
self.post_author_list.addItems(state.post_author) self.post_author_list.addItems(state.post_author)
if state.tracker == "rutracker": if state.tracker == "rutracker":
_, state.posts, _, _ = split_data(response) _, state.posts, _, _, cached = split_data(response)
state.post_titles, _, state.post_author = format_data(state.posts) state.post_titles, _, state.post_author = format_data(state.posts)
self.post_author_list.clear() self.post_author_list.clear()
self.post_author_list.addItems(state.post_author) self.post_author_list.addItems(state.post_author)
self.softwareList.clear() self.softwareList.clear()
self.softwareList.addItems(state.post_titles) self.softwareList.addItems(state.post_titles)
if state.debug == True:
print(f"Cached: {cached}")
if not response: if not response:
if state.debug: if state.debug:
print(f"No Results found for \"{search_text}\"") print(f"No Results found for \"{search_text}\"")
+3 -2
View File
@@ -49,13 +49,14 @@ def dlprogress():
return 0 return 0
def send_notification(): def send_notification():
while True: while True:
try: try:
for d in state.aria2.get_downloads(): for download in state.aria2:
if dlprogress() == 100: if dlprogress() == 100:
notification.notify( notification.notify(
title = "Download finished", title = "Download finished",
message=f"{d.name} has finished downloading.", message = f"{download.name} has finished downloading.",
timeout = 4 timeout = 4
) )
except Exception as e: except Exception as e:
+2 -2
View File
@@ -1,4 +1,4 @@
from dataclasses import dataclass from dataclasses import dataclass, field
from typing import Optional, Any, List, Dict from typing import Optional, Any, List, Dict
from pathlib import Path from pathlib import Path
@@ -14,7 +14,7 @@ class AppState:
download_path: str = str(Path.home() / "Downloads") download_path: str = str(Path.home() / "Downloads")
speed_limit: int = 0 speed_limit: int = 0
aria2process: Optional[Any] = None aria2process: Optional[Any] = None
aria2: Optional[Any] = None aria2: list[Any] = field(default_factory=list)
aria2_threads: int = 4 aria2_threads: int = 4
state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], download_path="") state = AppState(posts=[], post_titles=[], post_urls=[], post_author=[], download_path="")
+1 -1
View File
@@ -21,7 +21,7 @@ def get_item_url(item, posts, post_titles): # oftwarelist currentitem, post list
def get_magnet_link(post_url): def get_magnet_link(post_url):
try: try:
response = requests.get(post_url) response = requests.get(post_url) # eventually impl. cloudscraper
response.raise_for_status() response.raise_for_status()
soup = BeautifulSoup(response.text, 'html.parser') soup = BeautifulSoup(response.text, 'html.parser')
magnet_link = soup.find('a', href=lambda x: x and x.startswith('magnet:')) magnet_link = soup.find('a', href=lambda x: x and x.startswith('magnet:'))
+2 -1
View File
@@ -7,8 +7,9 @@ def split_data(data):
posts = p_json["data"] posts = p_json["data"]
query = p_json["query"] query = p_json["query"]
success = p_json["success"] success = p_json["success"]
cached = p_json["cached"]
return count, posts, query, success return count, posts, query, success, cached
def format_data(data): def format_data(data):
post_author = [post["author"] for post in data] post_author = [post["author"] for post in data]