mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 925fe21d03 | |||
| ec462afde6 | |||
| e50ef32c66 | |||
| d6e418d045 | |||
| a7c71b37f5 | |||
| 8fb1bb9e8d | |||
| 89fd8b4ebb |
@@ -2,7 +2,6 @@ import requests
|
|||||||
from core.utils.data.state import state
|
from core.utils.data.state import state
|
||||||
from core.utils.logging.logs import consoleLog
|
from core.utils.logging.logs import consoleLog
|
||||||
|
|
||||||
|
|
||||||
def scrape_rutracker(query):
|
def scrape_rutracker(query):
|
||||||
search = requests.get(f"{state.api_url}/search?q={query}")
|
search = requests.get(f"{state.api_url}/search?q={query}")
|
||||||
consoleLog("Sent request to server")
|
consoleLog("Sent request to server")
|
||||||
@@ -12,10 +11,9 @@ def scrape_rutracker(query):
|
|||||||
except Exception:
|
except Exception:
|
||||||
consoleLog("No results found / No response from server")
|
consoleLog("No results found / No response from server")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# This function utilizes the SoftwareManager server - source code can be found under the "server" branch.
|
# This function utilizes the SoftwareManager server - source code can be found under the SoftwareManager-Server repository.
|
||||||
|
|||||||
@@ -10,20 +10,16 @@ def scrape_uztracker(query):
|
|||||||
posts = []
|
posts = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
response = requests.get(search_url)
|
||||||
f"{search_url.rstrip('/')}/tracker.php",
|
|
||||||
params={'nm': query},
|
|
||||||
)
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
links = soup.find_all('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
links = soup.find_all('tr', class_="tCenter hl-tr", id=lambda x: x and x.startswith('tor_'))
|
||||||
|
|
||||||
for link in links:
|
for link in links:
|
||||||
if link.b:
|
|
||||||
title = link.b.text
|
|
||||||
url = urljoin(base_url, link['href'])
|
|
||||||
|
|
||||||
author_link = link.find_parent('td').find('a', class_="med ts-text")
|
theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
||||||
|
url = urljoin(base_url, theme_link['href'])
|
||||||
|
title = theme_link.b.text
|
||||||
|
author_link = link.find('a', class_="med")
|
||||||
author = author_link.text.strip() if author_link else "Unknown"
|
author = author_link.text.strip() if author_link else "Unknown"
|
||||||
|
|
||||||
posts.append(dict(
|
posts.append(dict(
|
||||||
@@ -37,6 +33,3 @@ def scrape_uztracker(query):
|
|||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
consoleLog(f"Failed to fetch {search_url}: {e}")
|
consoleLog(f"Failed to fetch {search_url}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
header = table.horizontalHeader()
|
header = table.horizontalHeader()
|
||||||
header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
|
header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
|
||||||
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed)
|
header.setSectionResizeMode(1, QHeaderView.ResizeMode.Fixed)
|
||||||
header.resizeSection(1, 200)
|
header.resizeSection(1, 500)
|
||||||
header.setStretchLastSection(False)
|
header.setStretchLastSection(False)
|
||||||
|
|
||||||
return table
|
return table
|
||||||
@@ -513,12 +513,12 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
def set_tracker(self, _):
|
def set_tracker(self, _):
|
||||||
|
old_tracker = state.tracker
|
||||||
state.tracker = self.tracker_list.currentText()
|
state.tracker = self.tracker_list.currentText()
|
||||||
|
|
||||||
while self.horizontal_layout.count():
|
old_widget = state.tracker_list[old_tracker]
|
||||||
item = self.horizontal_layout.takeAt(0)
|
self.horizontal_layout.removeWidget(old_widget)
|
||||||
if item.widget():
|
old_widget.setParent(None)
|
||||||
item.widget().setParent(None)
|
|
||||||
|
|
||||||
tracker_widget = state.tracker_list[state.tracker]
|
tracker_widget = state.tracker_list[state.tracker]
|
||||||
self.horizontal_layout.addWidget(tracker_widget)
|
self.horizontal_layout.addWidget(tracker_widget)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def get_active_interfaces():
|
|||||||
for addr in addr_list:
|
for addr in addr_list:
|
||||||
if addr.family == 2: # ipv4
|
if addr.family == 2: # ipv4
|
||||||
ipv4 = addr.address
|
ipv4 = addr.address
|
||||||
if not ipv4.startswith("127.") and not ipv4.startswith("169.254") and up == True:
|
if not ipv4.startswith("127.") and not ipv4.startswith("169.254") and up:
|
||||||
active.append(interface)
|
active.append(interface)
|
||||||
consoleLog(f"Found Active: {interface}")
|
consoleLog(f"Found Active: {interface}")
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ def list_interfaces() -> None:
|
|||||||
for addr in addr_list:
|
for addr in addr_list:
|
||||||
if addr.family == 2: # ipv4
|
if addr.family == 2: # ipv4
|
||||||
ipv4 = addr.address
|
ipv4 = addr.address
|
||||||
if not ipv4.startswith("127.") and not ipv4.startswith("169.254") and up == True:
|
if not ipv4.startswith("127.") and not ipv4.startswith("169.254") and up:
|
||||||
status = "ACTIVE"
|
status = "ACTIVE"
|
||||||
else:
|
else:
|
||||||
status = "INACTIVE"
|
status = "INACTIVE"
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
from core.utils.data.state import state
|
|
||||||
from core.utils.logging.logs import consoleLog
|
from core.utils.logging.logs import consoleLog
|
||||||
from core.utils.data.tracker import get_item_url
|
from core.utils.data.tracker import get_item_url
|
||||||
from core.utils.data.tracker import get_magnet_link
|
from core.utils.data.tracker import get_magnet_link
|
||||||
from core.network.libtorrent_wrapper import add_download
|
from core.network.libtorrent_wrapper import add_download
|
||||||
from core.utils.general.wrappers import run_thread
|
from core.utils.general.wrappers import run_thread
|
||||||
from core.utils.logging.logs import add_download_log
|
from core.utils.logging.logs import add_download_log
|
||||||
import time
|
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +23,6 @@ def run_download(item, posts, post_titles):
|
|||||||
add_download_log(item, post_url, magnet_uri, False)
|
add_download_log(item, post_url, magnet_uri, False)
|
||||||
|
|
||||||
def run_download_direct(magnet_uri):
|
def run_download_direct(magnet_uri):
|
||||||
|
consoleLog(f"Direct download: {magnet_uri[:60]}")
|
||||||
add_download(magnet_uri)
|
add_download(magnet_uri)
|
||||||
|
add_download_log("Direct Download", "", magnet_uri, False)
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user