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 .aria2p_server import run_aria2p
# from .scraper import uri
def start_client(): def start_client():
global aria2 global aria2
aria2 = run_aria2p() aria2 = run_aria2p()
+2 -14
View File
@@ -4,8 +4,8 @@ from PySide6.QtWidgets import QLineEdit, QWidget, QVBoxLayout, QListWidget, QToo
from PySide6.QtGui import QIcon, QAction from PySide6.QtGui import QIcon, QAction
import sys import sys
import darkdetect import darkdetect
from core.uztracker_scraper import scrape_uztracker from core.scraping.uztracker_scraper import scrape_uztracker
from core.uztracker_scraper import get_magnet_link from core.scraping.uztracker_scraper import get_magnet_link
from core.downloading.download import start_client from core.downloading.download import start_client
from core.downloading.download import add_magnet from core.downloading.download import add_magnet
@@ -102,15 +102,3 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
selected_magnet = get_magnet_link(selected) selected_magnet = get_magnet_link(selected)
start_client() start_client()
add_magnet(selected_magnet) add_magnet(selected_magnet)
def run_gui():
app = QtWidgets.QApplication([])
widget = MainWindow()
widget.show()
sys.exit(app.exec())
if __name__ == "__main__":
run_gui()
@@ -51,24 +51,6 @@ def get_post_title(post_url):
print("Program not found") 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): def get_magnet_link(post_url):
try: try:
response = requests.get(post_url) response = requests.get(post_url)
@@ -83,20 +65,7 @@ def get_magnet_link(post_url):
print(f"Failed to fetch {post_url}: {e}") print(f"Failed to fetch {post_url}: {e}")
# What x and x.startswith('magnet:') Does # What x and x.startswith('magnet:') Does
# x - check if x exists (not None/empty) # x - check if x exists (not None/empty)
# and - if x exists, THEN check the next part # and - if x exists, THEN check the next part
# x.startswith('magnet:') - does x start with "magnet:"? # 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)
-7
View File
@@ -1,15 +1,9 @@
from core.gui import run_gui as gui
from core.gui import MainWindow from core.gui import MainWindow
from PySide6.QtGui import QIcon, QAction
from PySide6 import QtWidgets from PySide6 import QtWidgets
import qdarktheme import qdarktheme
import darkdetect import darkdetect
import sys import sys
def run_gui(): def run_gui():
app = QtWidgets.QApplication([]) app = QtWidgets.QApplication([])
if darkdetect.isDark: if darkdetect.isDark:
@@ -21,6 +15,5 @@ def run_gui():
sys.exit(app.exec()) sys.exit(app.exec())
if __name__ == "__main__": if __name__ == "__main__":
run_gui() run_gui()