shayaa needs to fix rutracker NOW

This commit is contained in:
nosch
2026-03-07 16:52:27 +01:00
parent eba4c01fca
commit c76d179daa
8 changed files with 95 additions and 40 deletions
+16 -21
View File
@@ -147,30 +147,25 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
flush_log_buffer()
def create_tracker_table(headers, key):
table = QTableWidget()
table.setColumnCount(len(headers))
table.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
table.verticalHeader().setVisible(False)
table.setHorizontalHeaderLabels(headers)
# create tracker tables
state.trackertable
table = QTableWidget()
table.setColumnCount(len(headers))
table.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
table.verticalHeader().setVisible(False)
table.setHorizontalHeaderLabels(headers)
header = table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed)
header.resizeSection(1, 500)
header.setStretchLastSection(False)
table.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
table.viewport().setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
header = table.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed)
header.resizeSection(1, 500)
header.setStretchLastSection(False)
table.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
table.viewport().setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
state.tracker_list.update({key: table})
state.tracker_list.update({key: table})
create_tracker_table(["Post Title", "Author", "Seeders", "Leechers"], "rutracker")
create_tracker_table(["Post Title", "Author"], "uztracker")
create_tracker_table(["Post Title", "Author"], "m0nkrus")
create_tracker_table(["Game", "Availible Downloads"], "steamrip")
container = QWidget()
containerLayout = QVBoxLayout()
containerLayout.addWidget(self.searchbar)
+5 -4
View File
@@ -7,7 +7,7 @@ from copy import deepcopy
class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
"""
The dict should contain a:
name : str
$(keytosortby) : str
THIS IS REQUIRED
all other things will be displayed alphabetically after it.
@@ -20,13 +20,14 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
keys in ignorekeys will be ignored and not displayed, e.g. if oyu have links in the database which arent relevant
"""
def __init__(self, options: list[dict[str, str]], ignorekeys: list[str] = [], columnClicklShouldReturn = 1):
def __init__(self, options: list[dict[str, str]], ignorekeys: list[str] = [], columnClicklShouldReturn = 1, keytosortby = "name"):
super().__init__()
self.opts: list[dict[str, str]] = options
self.filtered_opts = deepcopy(self.opts)
self.ignorekeys = ignorekeys
self.returncolumn = columnClicklShouldReturn
self.sortkey = keytosortby
self.searchbox = QtWidgets.QLineEdit()
self.searchbox.setPlaceholderText("Search for a game on Steamrip")
@@ -74,7 +75,7 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
searchquery = self.searchbox.text()
options: Generator = fuzzyfinder.main.fuzzyfinder(searchquery, self.opts, accessor=lambda x: x["name"])
options: Generator = fuzzyfinder.main.fuzzyfinder(searchquery, self.opts, accessor=lambda x: x[self.sortkey])
self.filtered_opts = []
@@ -90,7 +91,7 @@ class FuzzySearchWindow(QtWidgets.QWidget): # should work everywhere
QtWidgets.QTableWidgetItem(value)
)
def cellClick(self, row: int, column: int):
def cellClick(self, row: int, _: int):
item = self.table.item(row, self.returncolumn)
if item is not None:
+1 -1
View File
@@ -19,7 +19,7 @@ def return_pressed(self):
return
consoleLog(f"User searched for: {search_text}")
if state.tracker == "rutracker":
if state.currenttracker == "rutracker":
response = scrape_rutracker(search_text)
if response:
_, state.posts, _, _, cached = split_data(response)