Code Cleanup

This commit is contained in:
Vxrtrauter
2025-09-03 22:16:30 +02:00
parent 4ddccc2341
commit 7cc79e69cb
4 changed files with 8 additions and 58 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
from .aria2p_server import run_aria2p
# from .scraper import uri
def start_client():
global aria2
aria2 = run_aria2p()
+3 -15
View File
@@ -4,8 +4,8 @@ from PySide6.QtWidgets import QLineEdit, QWidget, QVBoxLayout, QListWidget, QToo
from PySide6.QtGui import QIcon, QAction
import sys
import darkdetect
from core.uztracker_scraper import scrape_uztracker
from core.uztracker_scraper import get_magnet_link
from core.scraping.uztracker_scraper import scrape_uztracker
from core.scraping.uztracker_scraper import get_magnet_link
from core.downloading.download import start_client
from core.downloading.download import add_magnet
@@ -101,16 +101,4 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
print(selected)
selected_magnet = get_magnet_link(selected)
start_client()
add_magnet(selected_magnet)
def run_gui():
app = QtWidgets.QApplication([])
widget = MainWindow()
widget.show()
sys.exit(app.exec())
if __name__ == "__main__":
run_gui()
add_magnet(selected_magnet)
@@ -50,24 +50,6 @@ def get_post_title(post_url):
else:
print("Program not found")
def select_program():
selection = input("Enter the Number of the Program you want to download: ")
try:
index = int(selection) - 1
if 0 <= index < len(results): # note for myself: py starts counting at 0; check if number is not negative, check if number is not more than list length.
selected = "https://uztracker.net/" + results[index].lstrip("./")
post_url = selected
return selected
else:
print("Invalid Selection.")
except ValueError:
print(Exception)
return
def get_magnet_link(post_url):
try:
@@ -82,21 +64,8 @@ def get_magnet_link(post_url):
except requests.RequestException as e:
print(f"Failed to fetch {post_url}: {e}")
# What x and x.startswith('magnet:') Does
# x - check if x exists (not None/empty)
# and - if x exists, THEN check the next part
# x.startswith('magnet:') - does x start with "magnet:"?
if __name__ == "__main__":
search_input = input("Enter the Name of the Program you want to search for: ")
selected = scrape_uztracker(search_input)
maintitle = get_post_title(selected)
magnetlink = get_magnet_link(selected)
print(maintitle)
print(magnetlink)
# What x and x.startswith('magnet:') Does
# x - check if x exists (not None/empty)
# and - if x exists, THEN check the next part
# x.startswith('magnet:') - does x start with "magnet:"?
-7
View File
@@ -1,15 +1,9 @@
from core.gui import run_gui as gui
from core.gui import MainWindow
from PySide6.QtGui import QIcon, QAction
from PySide6 import QtWidgets
import qdarktheme
import darkdetect
import sys
def run_gui():
app = QtWidgets.QApplication([])
if darkdetect.isDark:
@@ -21,6 +15,5 @@ def run_gui():
sys.exit(app.exec())
if __name__ == "__main__":
run_gui()