mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ba11bfa78 | |||
| 43cbfe056c | |||
| 12df32f72a | |||
| 9e0ee2a36d | |||
| 5b9bdd2a2a | |||
| ff0e1a0798 | |||
| 891c5a86c1 | |||
| a5190f151c | |||
| 95f6640212 | |||
| 78a47e89d3 | |||
| e47efab901 | |||
| dbd5e79678 | |||
| 925579b9e0 | |||
| 1d969e5b9c | |||
| dbf396a187 |
@@ -27,22 +27,30 @@
|
|||||||
AppId={{8F2E4B6A-1C3D-4E5F-9A7B-0D8E6F2C4A1B}
|
AppId={{8F2E4B6A-1C3D-4E5F-9A7B-0D8E6F2C4A1B}
|
||||||
AppName={#MyAppName}
|
AppName={#MyAppName}
|
||||||
AppVersion={#MyAppVersion}
|
AppVersion={#MyAppVersion}
|
||||||
|
AppVerName={#MyAppName} {#MyAppVersion}
|
||||||
AppPublisher={#MyAppPublisher}
|
AppPublisher={#MyAppPublisher}
|
||||||
AppPublisherURL={#MyAppURL}
|
AppPublisherURL={#MyAppURL}
|
||||||
AppSupportURL={#MyAppURL}/issues
|
AppSupportURL={#MyAppURL}/issues
|
||||||
|
AppUpdatesURL={#MyAppURL}/releases
|
||||||
DefaultDirName={autopf}\{#MyAppName}
|
DefaultDirName={autopf}\{#MyAppName}
|
||||||
DefaultGroupName={#MyAppName}
|
DefaultGroupName={#MyAppName}
|
||||||
AllowNoIcons=yes
|
AllowNoIcons=yes
|
||||||
|
LicenseFile=LICENSE
|
||||||
OutputDir={#MyOutputDir}
|
OutputDir={#MyOutputDir}
|
||||||
OutputBaseFilename={#MyOutputFilename}
|
OutputBaseFilename={#MyOutputFilename}
|
||||||
Compression=lzma2
|
Compression=lzma2
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
|
DisableWelcomePage=no
|
||||||
PrivilegesRequired=lowest
|
PrivilegesRequired=lowest
|
||||||
PrivilegesRequiredOverridesAllowed=dialog
|
PrivilegesRequiredOverridesAllowed=dialog
|
||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||||
|
UninstallDisplayName={#MyAppName}
|
||||||
ArchitecturesAllowed=x64compatible
|
ArchitecturesAllowed=x64compatible
|
||||||
ArchitecturesInstallIn64BitMode=x64compatible
|
ArchitecturesInstallIn64BitMode=x64compatible
|
||||||
|
CloseApplications=yes
|
||||||
|
RestartApplications=yes
|
||||||
|
ShowLanguageDialog=auto
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
@@ -60,3 +68,4 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
|
|||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||||
|
Filename: "{app}\{#MyAppExeName}"; Flags: nowait skipifnotsilent
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ def scrape_uztracker(query):
|
|||||||
links = soup.find_all('tr', class_="tCenter hl-tr", id=lambda x: x and x.startswith('tor_'))
|
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:
|
||||||
|
|
||||||
theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
theme_link = link.find('a', class_="genmed tLink", href=lambda x: x and x.startswith('./viewtopic'))
|
||||||
|
if not theme_link or not theme_link.b:
|
||||||
|
continue
|
||||||
url = urljoin(base_url, theme_link['href'])
|
url = urljoin(base_url, theme_link['href'])
|
||||||
title = theme_link.b.text
|
title = theme_link.b.text
|
||||||
author_link = link.find('a', class_="med")
|
author_link = link.find('a', class_="med")
|
||||||
|
|||||||
@@ -121,24 +121,24 @@ def settings_dialog(self):
|
|||||||
# IMAGE PATH #
|
# IMAGE PATH #
|
||||||
###############
|
###############
|
||||||
|
|
||||||
image_path_container = QWidget()
|
# image_path_container = QWidget()
|
||||||
image_path_layout = QHBoxLayout()
|
# image_path_layout = QHBoxLayout()
|
||||||
|
|
||||||
image_path = QLineEdit()
|
# image_path = QLineEdit()
|
||||||
image_path_layout.addWidget(QLabel("Image Path (requires restart):"))
|
# image_path_layout.addWidget(QLabel("Image Path (requires restart):"))
|
||||||
image_path_layout.addWidget(image_path)
|
# image_path_layout.addWidget(image_path)
|
||||||
image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
# image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
image_path_container.setLayout(image_path_layout)
|
# image_path_container.setLayout(image_path_layout)
|
||||||
image_path.setText(state.image_path)
|
# image_path.setText(state.image_path)
|
||||||
|
|
||||||
def browse_image_path():
|
# def browse_image_path():
|
||||||
file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0]
|
# file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0]
|
||||||
if file_path:
|
# if file_path:
|
||||||
image_path.setText(file_path)
|
# image_path.setText(file_path)
|
||||||
|
|
||||||
browse_button = QPushButton("📁")
|
# browse_button = QPushButton("📁")
|
||||||
image_path_layout.addWidget(browse_button)
|
# image_path_layout.addWidget(browse_button)
|
||||||
browse_button.clicked.connect(browse_image_path)
|
# browse_button.clicked.connect(browse_image_path)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# SPEED LIMITING #
|
# SPEED LIMITING #
|
||||||
@@ -224,8 +224,6 @@ def settings_dialog(self):
|
|||||||
else:
|
else:
|
||||||
interface_select.setCurrentIndex(0)
|
interface_select.setCurrentIndex(0)
|
||||||
|
|
||||||
interface_select.setFixedWidth(180)
|
|
||||||
interface_select.setFixedHeight(30)
|
|
||||||
interface_select.setFixedWidth(180)
|
interface_select.setFixedWidth(180)
|
||||||
interface_select.setFixedHeight(30)
|
interface_select.setFixedHeight(30)
|
||||||
interface_layout.addWidget(interface_select)
|
interface_layout.addWidget(interface_select)
|
||||||
@@ -246,7 +244,7 @@ def settings_dialog(self):
|
|||||||
download_path.text(),
|
download_path.text(),
|
||||||
down_speed_limit.value(),
|
down_speed_limit.value(),
|
||||||
up_speed_limit.value(),
|
up_speed_limit.value(),
|
||||||
image_path.text(),
|
# image_path.text(),
|
||||||
autoresume_checkbox.isChecked(),
|
autoresume_checkbox.isChecked(),
|
||||||
max_connections.value(),
|
max_connections.value(),
|
||||||
max_downloads.value(),
|
max_downloads.value(),
|
||||||
@@ -258,7 +256,7 @@ def settings_dialog(self):
|
|||||||
|
|
||||||
self.tabs = QTabWidget()
|
self.tabs = QTabWidget()
|
||||||
self.tab1 = general_tab("General", autoresume_container, update_checkbox_container, transparent_window_container, self.tabs)
|
self.tab1 = general_tab("General", autoresume_container, update_checkbox_container, transparent_window_container, self.tabs)
|
||||||
self.tab2 = paths_tab("Paths", download_path_container, image_path_container, self.tabs)
|
self.tab2 = paths_tab("Paths", download_path_container, self.tabs)
|
||||||
self.tab3 = network_tab("Network", interface_container, max_connections_container, max_downloads_container, up_speed_limit_container, down_speed_limit_container, api_url_container, self.tabs)
|
self.tab3 = network_tab("Network", interface_container, max_connections_container, max_downloads_container, up_speed_limit_container, down_speed_limit_container, api_url_container, self.tabs)
|
||||||
|
|
||||||
dialog.layout().addWidget(self.tabs)
|
dialog.layout().addWidget(self.tabs)
|
||||||
|
|||||||
+56
-18
@@ -27,7 +27,6 @@ import requests as r
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import libtorrent as lt
|
import libtorrent as lt
|
||||||
import time
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
@@ -135,25 +134,46 @@ SVG_FOLDER = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path
|
|||||||
|
|
||||||
|
|
||||||
def download_update(latest_version):
|
def download_update(latest_version):
|
||||||
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
|
import tempfile
|
||||||
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
|
import time
|
||||||
|
|
||||||
print("Downloading update...", True)
|
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows-setup.exe"
|
||||||
response = r.get(url, allow_redirects=True)
|
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows-setup.exe"
|
||||||
with open(new_filename, "wb") as f:
|
installer_path = os.path.join(tempfile.gettempdir(), new_filename)
|
||||||
f.write(response.content)
|
|
||||||
if not os.path.exists(new_filename):
|
progress = QtWidgets.QProgressDialog("Downloading installer...", None, 0, 0)
|
||||||
|
progress.setWindowTitle("Updating")
|
||||||
|
progress.setWindowModality(Qt.WindowModality.ApplicationModal)
|
||||||
|
progress.setCancelButton(None)
|
||||||
|
progress.setMinimumDuration(0)
|
||||||
|
progress.setAutoClose(False)
|
||||||
|
progress.setAutoReset(False)
|
||||||
|
progress.setRange(0, 100)
|
||||||
|
progress.setValue(0)
|
||||||
|
progress.show()
|
||||||
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
|
response = r.get(url, allow_redirects=True, stream=True)
|
||||||
|
total = int(response.headers.get("content-length", 0))
|
||||||
|
downloaded = 0
|
||||||
|
with open(installer_path, "wb") as f:
|
||||||
|
for chunk in response.iter_content(chunk_size=65536):
|
||||||
|
f.write(chunk)
|
||||||
|
downloaded += len(chunk)
|
||||||
|
if total > 0:
|
||||||
|
progress.setValue(int(downloaded * 100 / total))
|
||||||
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
|
if not os.path.exists(installer_path):
|
||||||
|
progress.close()
|
||||||
raise FileNotFoundError("Executable not found")
|
raise FileNotFoundError("Executable not found")
|
||||||
subprocess.Popen([new_filename], shell=True)
|
|
||||||
time.sleep(0.5)
|
|
||||||
|
|
||||||
msg = QMessageBox()
|
progress.setLabelText("Installing update...")
|
||||||
msg.setIcon(QMessageBox.Icon.Information)
|
progress.setValue(100)
|
||||||
msg.setWindowTitle("New Version")
|
QtWidgets.QApplication.processEvents()
|
||||||
msg.setText("New version installed.")
|
|
||||||
msg.setInformativeText("Please remove the old exe.")
|
|
||||||
msg.setStandardButtons(QMessageBox.StandardButton.Ok)
|
|
||||||
|
|
||||||
|
subprocess.Popen([installer_path, "/VERYSILENT", "/SUPPRESSMSGBOXES", "/SP-", "/CLOSEAPPLICATIONS"])
|
||||||
|
time.sleep(1)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
@@ -162,11 +182,13 @@ def windowCloseHelper():
|
|||||||
|
|
||||||
class MainWindow(QtWidgets.QMainWindow, QWidget):
|
class MainWindow(QtWidgets.QMainWindow, QWidget):
|
||||||
log_signal = Signal(str) # Thread-safe signal for logging
|
log_signal = Signal(str) # Thread-safe signal for logging
|
||||||
|
search_finished_signal = Signal() # Thread-safe signal for search completion
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
MainWindow._instance = self
|
MainWindow._instance = self
|
||||||
self.log_signal.connect(self._on_log_signal)
|
self.log_signal.connect(self._on_log_signal)
|
||||||
|
self.search_finished_signal.connect(self._on_search_finished)
|
||||||
|
|
||||||
pixmap = QPixmap()
|
pixmap = QPixmap()
|
||||||
image_data = base64.b64decode(logo_base64)
|
image_data = base64.b64decode(logo_base64)
|
||||||
@@ -216,7 +238,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.searchbar.setPlaceholderText("Search for software...")
|
self.searchbar.setPlaceholderText("Search for software...")
|
||||||
self.searchbar.setClearButtonEnabled(True)
|
self.searchbar.setClearButtonEnabled(True)
|
||||||
self.searchbar.setMinimumHeight(30)
|
self.searchbar.setMinimumHeight(30)
|
||||||
self.searchbar.returnPressed.connect(lambda: run_thread(threading.Thread(target=return_pressed, args=(self,)))) # Triggers data function thread on enter
|
self.searchbar.returnPressed.connect(self._start_search)
|
||||||
|
|
||||||
self.dlbutton = QtWidgets.QPushButton("Download")
|
self.dlbutton = QtWidgets.QPushButton("Download")
|
||||||
self.dlbutton.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.dlbutton.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
@@ -299,7 +321,10 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
|
|
||||||
container = QWidget()
|
container = QWidget()
|
||||||
containerLayout = QVBoxLayout()
|
containerLayout = QVBoxLayout()
|
||||||
containerLayout.addWidget(self.searchbar)
|
|
||||||
|
search_row = QHBoxLayout()
|
||||||
|
search_row.addWidget(self.searchbar)
|
||||||
|
containerLayout.addLayout(search_row)
|
||||||
containerLayout.addWidget(state.tracker_list[state.tracker])
|
containerLayout.addWidget(state.tracker_list[state.tracker])
|
||||||
|
|
||||||
class DownloadModel(QAbstractTableModel):
|
class DownloadModel(QAbstractTableModel):
|
||||||
@@ -662,6 +687,19 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
self.context_menu.addAction("Cancel Download", self.cancelDownloadAction)
|
self.context_menu.addAction("Cancel Download", self.cancelDownloadAction)
|
||||||
self.context_menu.addAction("Delete File", self.deleteFileAction)
|
self.context_menu.addAction("Delete File", self.deleteFileAction)
|
||||||
|
|
||||||
|
def _start_search(self):
|
||||||
|
self.searchbar.setEnabled(False)
|
||||||
|
def _search_thread():
|
||||||
|
try:
|
||||||
|
return_pressed(self)
|
||||||
|
finally:
|
||||||
|
self.search_finished_signal.emit()
|
||||||
|
run_thread(threading.Thread(target=_search_thread))
|
||||||
|
|
||||||
|
def _on_search_finished(self):
|
||||||
|
self.searchbar.setEnabled(True)
|
||||||
|
self.searchbar.setFocus()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_log(text):
|
def add_log(text):
|
||||||
if MainWindow._instance:
|
if MainWindow._instance:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def return_pressed(self):
|
|||||||
|
|
||||||
elif state.tracker is not None:
|
elif state.tracker is not None:
|
||||||
state.posts = scrapers[state.tracker](search_text)
|
state.posts = scrapers[state.tracker](search_text)
|
||||||
if state.posts == []:
|
if not state.posts:
|
||||||
consoleLog(f"No Results for {search_text}")
|
consoleLog(f"No Results for {search_text}")
|
||||||
state.tracker_list[state.tracker].clear()
|
state.tracker_list[state.tracker].clear()
|
||||||
self.show_empty_results(True)
|
self.show_empty_results(True)
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ def general_tab(title, autoresume, update_checkbox, transparent_window, tabs):
|
|||||||
tabs.addTab(tab, title)
|
tabs.addTab(tab, title)
|
||||||
return tab
|
return tab
|
||||||
|
|
||||||
def paths_tab(title, download_path, image_path, tabs):
|
def paths_tab(title, download_path, tabs):
|
||||||
tab = QWidget()
|
tab = QWidget()
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
layout.addWidget(download_path)
|
layout.addWidget(download_path)
|
||||||
layout.addWidget(image_path)
|
# layout.addWidget(image_path)
|
||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
tab.setLayout(layout)
|
tab.setLayout(layout)
|
||||||
tabs.addTab(tab, title)
|
tabs.addTab(tab, title)
|
||||||
|
|||||||
@@ -74,10 +74,13 @@ def add_download(magnet_uri, dl_path=state.download_path):
|
|||||||
consoleLog("Skipping Downloading, download already running... ")
|
consoleLog("Skipping Downloading, download already running... ")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
magnetdl = lt.parse_magnet_uri(magnet_uri)
|
try:
|
||||||
magnetdl.save_path = dl_path
|
magnetdl = lt.parse_magnet_uri(magnet_uri)
|
||||||
|
magnetdl.save_path = dl_path
|
||||||
download = state.dl_session.add_torrent(magnetdl)
|
download = state.dl_session.add_torrent(magnetdl)
|
||||||
|
except Exception as e:
|
||||||
|
consoleLog(f"Failed to add torrent: {e}")
|
||||||
|
return False
|
||||||
state.active_downloads[magnet_uri] = download
|
state.active_downloads[magnet_uri] = download
|
||||||
consoleLog(f"Added {magnet_uri} to downloads")
|
consoleLog(f"Added {magnet_uri} to downloads")
|
||||||
|
|
||||||
@@ -95,10 +98,13 @@ def add_seed(magnet_uri, file_path):
|
|||||||
consoleLog("Already seeding this torrent")
|
consoleLog("Already seeding this torrent")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
magnetdl = lt.parse_magnet_uri(magnet_uri)
|
try:
|
||||||
magnetdl.save_path = os.path.dirname(file_path)
|
magnetdl = lt.parse_magnet_uri(magnet_uri)
|
||||||
|
magnetdl.save_path = os.path.dirname(file_path)
|
||||||
handle = state.dl_session.add_torrent(magnetdl)
|
handle = state.dl_session.add_torrent(magnetdl)
|
||||||
|
except Exception as e:
|
||||||
|
consoleLog(f"Failed to add seed: {e}")
|
||||||
|
return False
|
||||||
state.active_downloads[magnet_uri] = handle
|
state.active_downloads[magnet_uri] = handle
|
||||||
state.seeded_magnets.add(magnet_uri)
|
state.seeded_magnets.add(magnet_uri)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def get_item_url(item, posts, post_titles): # softwarelist currentitem, post lis
|
|||||||
|
|
||||||
def get_magnet_link(post_url):
|
def get_magnet_link(post_url):
|
||||||
try:
|
try:
|
||||||
response = requests.get(post_url) # eventually impl. cloudscraper
|
response = requests.get(post_url, timeout=15) # eventually impl. cloudscraper
|
||||||
consoleLog("Sent Request to retrieve Magnet Link...")
|
consoleLog("Sent Request to retrieve Magnet Link...")
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ def check_downloads(downloads):
|
|||||||
for download in downloads:
|
for download in downloads:
|
||||||
if os.path.exists(download.path):
|
if os.path.exists(download.path):
|
||||||
consoleLog(f"Existing Download: {download.title}")
|
consoleLog(f"Existing Download: {download.title}")
|
||||||
seed_magnet(download.magnet_uri, download.path)
|
try:
|
||||||
|
seed_magnet(download.magnet_uri, download.path)
|
||||||
|
except Exception as e:
|
||||||
|
consoleLog(f"Failed to seed {download.title}: {e}")
|
||||||
else:
|
else:
|
||||||
consoleLog(f"Inexistent Download: {download.title}")
|
consoleLog(f"Inexistent Download: {download.title}")
|
||||||
remove_download_log(download.magnet_uri)
|
remove_download_log(download.magnet_uri)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def _remove_download_log_inner(magnet_uri) -> DownloadList:
|
|||||||
|
|
||||||
|
|
||||||
magnet_link = (magnet_uri or "").strip()
|
magnet_link = (magnet_uri or "").strip()
|
||||||
title = next((getattr(d, 'title', 'Unknown') for d in downloads if (getattr(d, 'magnet_uri', None) or '').strip() == magnet_link or (getattr(d, 'url', None) or '').strip() == magnet_link))
|
title = next((getattr(d, 'title', 'Unknown') for d in downloads if (getattr(d, 'magnet_uri', None) or '').strip() == magnet_link or (getattr(d, 'url', None) or '').strip() == magnet_link), 'Unknown')
|
||||||
downloads = [d for d in downloads if (getattr(d, 'magnet_uri', None) or "").strip() != magnet_link and (getattr(d, 'url', None) or "").strip() != magnet_link]
|
downloads = [d for d in downloads if (getattr(d, 'magnet_uri', None) or "").strip() != magnet_link and (getattr(d, 'url', None) or "").strip() != magnet_link]
|
||||||
|
|
||||||
consoleLog(f"Removed {title} from Log File")
|
consoleLog(f"Removed {title} from Log File")
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ from core.utils.logging.logs import consoleLog
|
|||||||
|
|
||||||
def check_for_updates():
|
def check_for_updates():
|
||||||
url = f"https://api.github.com/repos/KeksPirates/SoftwareManager/releases"
|
url = f"https://api.github.com/repos/KeksPirates/SoftwareManager/releases"
|
||||||
response = requests.get(url)
|
response = requests.get(url, timeout=15)
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
consoleLog(f"Failed to fetch releases: {response.status_code}")
|
consoleLog(f"Failed to fetch releases: {response.status_code}")
|
||||||
exit(1)
|
return None, None
|
||||||
|
|
||||||
releases = response.json()
|
releases = response.json()
|
||||||
releases.sort(key=lambda r: r["published_at"], reverse=True)
|
releases.sort(key=lambda r: r["published_at"], reverse=True)
|
||||||
|
|||||||
+2
-1
@@ -56,7 +56,8 @@ def main():
|
|||||||
consoleLog("Started Thread: check_completed")
|
consoleLog("Started Thread: check_completed")
|
||||||
run_thread(threading.Thread(target=check_deleted_files, args=(shutdown_event,), daemon=True))
|
run_thread(threading.Thread(target=check_deleted_files, args=(shutdown_event,), daemon=True))
|
||||||
consoleLog("Started Thread: check_deleted_files")
|
consoleLog("Started Thread: check_deleted_files")
|
||||||
check_downloads(downloads)
|
run_thread(threading.Thread(target=check_downloads, args=(downloads,)))
|
||||||
|
consoleLog("Started Thread: check_downloads")
|
||||||
elapsed = time.perf_counter() - start_time
|
elapsed = time.perf_counter() - start_time
|
||||||
consoleLog(f"Initialization completed in {elapsed:.2f}s. Launching GUI")
|
consoleLog(f"Initialization completed in {elapsed:.2f}s. Launching GUI")
|
||||||
run_gui()
|
run_gui()
|
||||||
|
|||||||
Reference in New Issue
Block a user