Compare commits

...

31 Commits

Author SHA1 Message Date
KeksNino 59e45efbb6 fix aria2c dependency in pyinstaller 2025-10-25 21:59:29 +02:00
KeksNino 27f0a3f71d fix wget path on windows in workflows 2025-10-25 21:57:31 +02:00
KeksNino 1d500305f7 add aria2c dependency to exe binary on windows 2025-10-25 21:52:39 +02:00
Vxrtrauter 20a310264f Merge branch 'main' of https://github.com/KeksPirates/SoftwareManager 2025-10-24 10:51:51 +02:00
Vxrtrauter aee8f16353 rm unused import 2025-10-24 10:50:52 +02:00
KeksNino 2354adb349 update updater download url 2025-10-20 19:10:49 +02:00
KeksNino 4c69a17f0e change back to releases for github workflow 2025-10-20 18:44:42 +02:00
KeksNino 2bab6c3321 fix old filename for updater 2025-10-20 18:22:16 +02:00
KeksNino 91482760b6 fix updater filename 2025-10-20 18:14:09 +02:00
KeksNino 83fa23df58 fix release file names 2025-10-20 17:58:40 +02:00
KeksNino 41d28095c2 fix workflows 2025-10-20 17:53:35 +02:00
KeksNino de2e49e60b add back commit sha to release file name 2025-10-20 17:40:39 +02:00
KeksNino dd6d16d833 fix workflows (again) 2025-10-20 17:24:04 +02:00
KeksNino 7d0c8d16ec fix workflows (again) 2025-10-20 17:21:47 +02:00
KeksNino 80750f010f fix workflows (again) 2025-10-20 17:00:14 +02:00
KeksNino c93f6345c8 fix workflows (again) 2025-10-20 16:36:10 +02:00
KeksNino a7132ed1cd fix workflows (again) 2025-10-19 19:45:19 +02:00
KeksNino a2cff15d0d fix workflows (hopefully) 2025-10-19 19:39:33 +02:00
KeksNino 2eb384f7cf fix build_info.json 2025-10-19 17:51:21 +02:00
KeksNino 05a5b04507 fix error if build_info doesnt exist in source code 2025-10-19 16:22:49 +02:00
KeksNino 87c974f124 add build_info.json to workflow for win updater 2025-10-19 15:58:16 +02:00
KeksNino 95a687ddd9 fix updater 2025-10-19 04:07:41 +02:00
KeksNino 813d2b31c4 add setting to ignore updates on windows 2025-10-19 04:05:57 +02:00
Vxrtrauter deb5ce5b88 fixed aria2 killing issues on settings close 2025-10-19 03:53:52 +02:00
Vxrtrauter a11c1d7129 added dev release for version check 2025-10-19 03:23:37 +02:00
Vxrtrauter dcc78ade44 fixed qtablewidget colors 2025-10-19 03:13:08 +02:00
KeksNino 10e80ab4b6 fix row count 2025-10-19 02:58:02 +02:00
KeksNino 3290ff3fac switch to spreadsheet view in softwareList
QTableWidget
2025-10-19 02:56:10 +02:00
Vxrtrauter d5d99d6a0e fix debug outputs for update checker 2025-10-18 23:55:25 +02:00
Vxrtrauter 3960612f94 fix settings icon not showing up 2025-10-18 23:47:54 +02:00
KeksNino a37a47b65b add update checker file for windows 2025-10-18 22:40:25 +02:00
8 changed files with 219 additions and 146 deletions
+55 -39
View File
@@ -25,16 +25,19 @@ jobs:
matrix:
include:
- os: ubuntu-latest
artifact_name: SoftwareManager-dev-linux
asset_name: SoftwareManager-dev-linux
artifact_name: SoftwareManager-dev-${{ github.sha }}-linux
asset_name: SoftwareManager-dev-${{ github.sha }}-linux
- os: windows-latest
artifact_name: SoftwareManager-dev-windows.exe
asset_name: SoftwareManager-dev-windows.exe
artifact_name: SoftwareManager-dev-${{ github.sha }}-windows.exe
asset_name: SoftwareManager-dev-${{ github.sha }}-windows.exe
- os: macos-latest
artifact_name: SoftwareManager-dev-macos
asset_name: SoftwareManager-dev-macos
artifact_name: SoftwareManager-dev-${{ github.sha }}-macos
asset_name: SoftwareManager-dev-${{ github.sha }}-macos
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.version.outputs.version }}
short_sha: ${{ steps.version.outputs.short_sha }}
steps:
- name: Checkout code
@@ -66,7 +69,40 @@ jobs:
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
- name: Generate version
id: version
shell: bash
run: |
COMMIT_SHA=${{ github.sha }}
SHORT_SHA=${COMMIT_SHA:0:7}
VERSION="${SHORT_SHA}-dev"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "Generated version: $VERSION"
- name: Inject commit hash into code (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$json = '{
"version": "' + $env:VERSION + '"
}'
$json | Out-File -Encoding utf8 build_info.json
- name: Download aria2c (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p deps
C:\msys64\usr\bin\wget.exe https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
unzip -j aria2-1.37.0-win-64bit-build1.zip aria2-1.37.0-win-64bit-build1/aria2c.exe -d deps/
- name: Build executable with PyInstaller (Windows)
if: runner.os == 'Windows'
run: pyinstaller --onefile --windowed --add-data "build_info.json:." --add-data "deps/aria2c.exe:." --name ${{ env.APP_NAME }} main.py
- name: Build executable with PyInstaller (Unix)
if: runner.os != 'Windows'
run: pyinstaller --onefile --windowed --name ${{ env.APP_NAME }} main.py
- name: Make executable (Unix)
@@ -94,49 +130,29 @@ jobs:
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display downloaded artifacts
run: |
echo "Downloaded artifacts:"
find artifacts -type f
ls -la artifacts/
- name: Generate version
id: version
run: |
COMMIT_SHA=${{ github.sha }}
SHORT_SHA=${COMMIT_SHA:0:7}
VERSION="${SHORT_SHA}-dev"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "Generated version: ${VERSION}"
- name: Prepare release files
run: |
mkdir -p release
cp artifacts/ubuntu-latest-build/SoftwareManager-dev-linux release/SoftwareManager-dev-linux
cp artifacts/windows-latest-build/SoftwareManager-dev-windows.exe release/SoftwareManager-dev-windows.exe
cp artifacts/macos-latest-build/SoftwareManager-dev-macos release/SoftwareManager-dev-macos
chmod +x release/SoftwareManager-dev-linux release/SoftwareManager-dev-macos
SHORT_SHA="${{ needs.build.outputs.short_sha }}"
cp artifacts/ubuntu-latest-build/SoftwareManager-dev-*-linux release/SoftwareManager-dev-${SHORT_SHA}-linux
cp artifacts/windows-latest-build/SoftwareManager-dev-*-windows.exe release/SoftwareManager-dev-${SHORT_SHA}-windows.exe
cp artifacts/macos-latest-build/SoftwareManager-dev-*-macos release/SoftwareManager-dev-${SHORT_SHA}-macos
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
ls -la release/
- name: Create Release (Public)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
draft: false
prerelease: false
tag_name: ${{ needs.build.outputs.version }}
name: ${{ needs.build.outputs.version }}
files: |
release/SoftwareManager-dev-linux
release/SoftwareManager-dev-windows.exe
release/SoftwareManager-dev-macos
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+16 -5
View File
@@ -10,12 +10,10 @@ from PySide6.QtWidgets import (
QLabel,
QHBoxLayout,
QSpinBox,
QCheckBox,
)
def settings_dialog(self):
if state.debug:
@@ -29,7 +27,20 @@ def settings_dialog(self):
def close_settings():
dialog.reject()
checkbox_container = QWidget()
checkbox_layout = QHBoxLayout()
# ignore updates checkbox
checkbox = QCheckBox()
checkbox_container.setLayout(checkbox_layout)
checkbox_layout.addWidget(QLabel("Ignore Updates: "))
checkbox_layout.addStretch()
checkbox.setChecked(state.ignore_updates)
checkbox.toggled.connect(lambda checked: setattr(state, 'ignore_updates', checked))
checkbox_layout.addWidget(checkbox)
dialog.layout().addWidget(checkbox_container)
##################
# THREAD SETTING #
##################
@@ -119,4 +130,4 @@ def settings_dialog(self):
dialog.layout().addLayout(layout)
dialog.exec()
dialog.exec()
+73 -53
View File
@@ -3,19 +3,21 @@ from PySide6 import QtCore
from PySide6.QtCore import Qt, QTimer, QModelIndex, QAbstractTableModel
from PySide6.QtWidgets import (
QLineEdit,
QTableView,
QWidget,
QVBoxLayout,
QListWidget,
QToolBar,
QLabel,
QTableView,
QWidget,
QVBoxLayout,
QListWidget,
QToolBar,
QLabel,
QHBoxLayout,
QComboBox,
QComboBox,
QTabWidget,
QProgressBar,
QHeaderView,
QMessageBox,
QTableWidget,
)
from PySide6.QtGui import QIcon, QAction, QCloseEvent
import darkdetect
import threading
@@ -25,7 +27,7 @@ import os
import subprocess
import time
import sys
from core.utils.config.settings import save_settings
import json
from core.utils.general.wrappers import run_thread
from core.utils.data.state import state
from core.utils.network.download import download_selected
@@ -36,44 +38,52 @@ from core.interface.utils.searchhelper import return_pressed
from core.interface.dialogs.settings import settings_dialog
from core.network.aria2_integration import dlprogress
def download_update(latest_version):
filename = "SoftwareManager-dev-windows.exe"
url = "https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-windows.exe"
old_filename = f"SoftwareManager-dev-{state.version.replace('-dev', '')}-windows.exe"
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
print("Downloading update...")
if os.path.exists(filename):
os.remove(filename)
if os.path.exists(old_filename):
os.remove(old_filename)
response = r.get(url, allow_redirects=True)
with open(filename, "wb") as f:
with open(new_filename, "wb") as f:
f.write(response.content)
if not os.path.exists(filename):
raise FileNotFoundError(f"Executable not found")
subprocess.Popen([filename], shell=True)
if not os.path.exists(new_filename):
raise FileNotFoundError("Executable not found")
subprocess.Popen([new_filename], shell=True)
time.sleep(0.5)
save_settings(version=latest_version)
sys.exit(0)
class MainWindow(QtWidgets.QMainWindow, QWidget):
def __init__(self):
super().__init__()
searchresults = []
build_info_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "build_info.json")
if os.path.exists(build_info_path):
with open(build_info_path, "r") as f:
build_info = json.load(f)
state.version = build_info.get("version")
# Check for updates on Windows
if platform.system() == "Windows":
result = check_for_updates()
assets, latest_version = result
if state.ignore_updates is False:
if platform.system() == "Windows":
result = check_for_updates()
assets, latest_version = result
if assets:
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle("Update Available")
msg.setText(f"A new version is available.")
msg.setInformativeText("Please visit the GitHub releases page to download the latest version.")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore)
if assets:
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle("Update Available")
msg.setText("A new version is available.")
msg.setInformativeText("Please visit the GitHub releases page to download the latest version.")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore)
response = msg.exec_()
if response == QMessageBox.Ok:
download_update(latest_version)
response = msg.exec_()
if response == QMessageBox.Ok:
download_update(latest_version)
self.setWindowTitle("Software Manager")
self.setGeometry(100, 100, 800, 600)
@@ -87,42 +97,49 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.searchbar.setClearButtonEnabled(True)
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.dlbutton = QtWidgets.QPushButton("Download")
self.softwareList = QListWidget()
self.post_author_list = QListWidget()
self.libraryList = QListWidget()
self.emptyResults = QLabel("No Results")
self.emptyResults.setAlignment(Qt.AlignCenter)
self.emptyResults.hide()
self.download_model = None
self.downloadList = QTableView()
self.emptyLibrary = QLabel("No items in library.")
self.emptyDownload = QLabel("No items in downloads.")
self.progressbar = QProgressBar()
self.qtablewidget = QTableWidget()
self.qtablewidget.setColumnCount(2)
self.qtablewidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.qtablewidget.verticalHeader().setVisible(False)
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
self.qtablewidget.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
self.qtablewidget.setAttribute(Qt.WA_TranslucentBackground)
self.qtablewidget.viewport().setAttribute(Qt.WA_TranslucentBackground)
header = self.qtablewidget.horizontalHeader()
header.setSectionResizeMode(1, QHeaderView.Fixed)
header.resizeSection(1, 500)
container = QWidget()
containerLayout = QVBoxLayout()
containerLayout.addWidget(self.searchbar)
containerLayout.addWidget(self.softwareList)
containerLayout.addWidget(self.post_author_list)
self.softwareList.addItems(searchresults)
containerLayout.addWidget(self.qtablewidget)
class DownloadModel(QAbstractTableModel):
def __init__(self):
super().__init__()
self.headers = ["Name", "Status", "Progress", "Speed", "Size", "Total Size"]
def rowCount(self, parent=QModelIndex()):
return len(state.downloads)
def columnCount(self, parent=QModelIndex()):
return len(self.headers)
def headerData(self, section, orientation, role=Qt.DisplayRole):
if role == Qt.DisplayRole and orientation == Qt.Horizontal:
return self.headers[section]
@@ -132,7 +149,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
if role == Qt.DisplayRole:
download = state.downloads[index.row()]
col = index.column()
if col == 0:
return download.name
elif col == 1:
@@ -152,9 +169,11 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.downloadList.horizontalHeader().setStretchLastSection(False)
self.downloadList.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
self.downloadList.setSelectionBehavior(QTableView.SelectRows)
self.downloadList.setAttribute(Qt.WA_TranslucentBackground)
self.downloadList.viewport().setAttribute(Qt.WA_TranslucentBackground)
# download button triggers
self.dlbutton.clicked.connect(lambda: run_thread(threading.Thread(target=download_selected, args=(self.softwareList.currentItem(), state.posts, state.post_titles))))
self.dlbutton.clicked.connect(lambda: run_thread(threading.Thread(target=download_selected, args=(self.qtablewidget.currentItem(), state.posts, state.post_titles))))
container.setLayout(containerLayout)
self.setCentralWidget(container)
@@ -163,14 +182,15 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.tabs = QTabWidget()
self.horizontal_layout = QHBoxLayout()
self.horizontal_layout.addWidget(self.softwareList, stretch=3)
self.horizontal_layout.addWidget(self.emptyResults, stretch=3)
self.horizontal_layout.addWidget(self.post_author_list)
self.tab1 = create_tab("Search", self.searchbar, self.softwareList, self.tabs, self.dlbutton, self.horizontal_layout)
self.horizontal_layout.addWidget(self.qtablewidget)
self.tab1 = create_tab("Search", self.searchbar, self.qtablewidget, self.tabs, self.dlbutton, self.horizontal_layout)
self.tab2 = create_tab("Library", self.emptyLibrary, self.libraryList, self.tabs, None, None)
self.tab3 = create_tab("Downloads", self.emptyDownload, self.downloadList, self.tabs, None, None)
containerLayout.addWidget(self.tabs)
containerLayout.setAlignment(Qt.AlignmentFlag.AlignBottom)
@@ -178,15 +198,15 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
toolbar = QToolBar("Main Toolbar")
self.addToolBar(toolbar)
toolbar.setLayoutDirection(Qt.RightToLeft)
self.tracker_list = QComboBox()
self.tracker_list.addItems(["rutracker", "uztracker", "m0nkrus"])
self.tracker_list.activated.connect(self.set_tracker)
if darkdetect.isDark():
settings_action = QAction(QIcon("core/interface/assets/settings_dark.png"), "Settings", self)
settings_action = QAction(QIcon("core/interface/assets/settings_white.png"), "Settings", self)
else:
settings_action = QAction(QIcon("core/interface/assets/settings.png"), "Settings", self)
settings_action = QAction(QIcon("core/interface/assets/settings_black.png"), "Settings", self)
settings_action.triggered.connect(lambda: settings_dialog(self))
toolbar.addAction(settings_action)
@@ -196,7 +216,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.progressbar.setValue(0)
containerLayout.addWidget(self.progressbar)
self.progress_timer = QTimer()
self.progress_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.update_progress)))
self.progress_timer.start(1000)
@@ -223,8 +243,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def show_empty_results(self, show: bool):
if show:
self.softwareList.hide()
self.qtablewidget.hide()
self.emptyResults.show()
else:
self.emptyResults.hide()
self.softwareList.show()
self.qtablewidget.show()
+27 -16
View File
@@ -1,3 +1,4 @@
from PySide6.QtWidgets import QTableWidgetItem
from core.data.scrapers.uztracker import scrape_uztracker
from core.data.scrapers.rutracker import scrape_rutracker
from core.data.scrapers.monkrus import scrape_monkrus_telegram
@@ -17,20 +18,24 @@ def return_pressed(self):
response = scrape_uztracker(search_text)
if response:
state.post_titles, state.post_urls = response
self.softwareList.clear()
self.qtablewidget.clear()
if state.post_titles and len(state.post_titles) > 0:
self.softwareList.addItems(state.post_titles)
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
self.qtablewidget.setRowCount(len(state.post_titles))
for i, author in enumerate(state.post_author):
self.qtablewidget.setItem(i, 1, QTableWidgetItem(author))
for i, title in enumerate(state.post_titles):
self.qtablewidget.setItem(i, 0, QTableWidgetItem(title))
self.show_empty_results(False)
self.post_author_list.clear()
else:
if state.debug:
print(f"No Results for {search_text}")
self.softwareList.clear()
self.qtablewidget.clear()
self.show_empty_results(True)
else:
if state.debug:
print(f"No response from uztracker")
self.softwareList.clear()
self.qtablewidget.clear()
self.show_empty_results(True)
elif state.tracker == "rutracker":
@@ -40,21 +45,24 @@ def return_pressed(self):
if state.posts == []:
if state.debug:
print(f"No Results for {search_text}")
self.softwareList.clear()
self.qtablewidget.clear()
self.show_empty_results(True)
else:
state.post_titles, _, state.post_author = format_data(state.posts)
self.show_empty_results(False)
self.post_author_list.clear()
self.post_author_list.addItems(state.post_author)
self.softwareList.clear()
self.softwareList.addItems(state.post_titles)
self.qtablewidget.clear()
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
self.qtablewidget.setRowCount(len(state.post_titles))
for i, author in enumerate(state.post_author):
self.qtablewidget.setItem(i, 1, QTableWidgetItem(author))
for i, title in enumerate(state.post_titles):
self.qtablewidget.setItem(i, 0, QTableWidgetItem(title))
if state.debug == True:
print(f"Response Cached: {cached}")
else:
if state.debug:
print(f"No response from rutracker")
self.softwareList.clear()
self.qtablewidget.clear()
self.show_empty_results(True)
elif state.tracker == "m0nkrus":
@@ -63,12 +71,15 @@ def return_pressed(self):
if state.posts == []:
if state.debug:
print(f"No Results for {search_text}")
self.softwareList.clear()
self.qtablewidget.clear()
self.show_empty_results(True)
else:
state.post_titles, _, state.post_author = format_data(state.posts)
self.show_empty_results(False)
self.post_author_list.clear()
self.post_author_list.addItems(state.post_author)
self.softwareList.clear()
self.softwareList.addItems(state.post_titles)
self.qtablewidget.clear()
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
self.qtablewidget.setRowCount(len(state.post_titles))
for i, author in enumerate(state.post_author):
self.qtablewidget.setItem(i, 1, QTableWidgetItem(author))
for i, title in enumerate(state.post_titles):
self.qtablewidget.setItem(i, 0, QTableWidgetItem(title))
+3 -3
View File
@@ -6,8 +6,8 @@ from core.utils.data.state import state
def create_config():
config = configparser.ConfigParser()
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}", "download_path": f"{state.download_path}", f"speed_limit": f"{state.speed_limit}",
"version": f"{state.version}"}
config["General"] = {"debug": True, "api_url": f"{state.api_url}", "aria2_threads": f"{state.aria2_threads}", "download_path": f"{state.download_path}", f"speed_limit": f"{state.speed_limit}",
"ignore_updates": f"{state.ignore_updates}"}
if platform.system() == "Windows":
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
@@ -42,4 +42,4 @@ def read_config():
state.aria2_threads = config.getint("General", "aria2_threads")
state.download_path = config.get("General", "download_path")
state.speed_limit = config.getint("General", "speed_limit")
state.version = config.get("General", "version")
state.ignore_updates = config.getboolean("General", "ignore_updates")
+8 -30
View File
@@ -1,39 +1,19 @@
from core.utils.data.state import state
from core.utils.general.shutdown import kill_aria2server
from .config import create_config
def restart_aria2c():
import main # had to do this because of circle import :(
import signal
import atexit
import time
kill_aria2server()
state.aria2process.wait()
state.aria2process = main.run_aria2server()
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
atexit.unregister(kill_aria2server)
atexit.register(kill_aria2server)
try:
main.kill_aria2server()
except Exception as e:
print(f"Warning: aria2server kill failed: {e}")
try:
if state.aria2process:
state.aria2process.wait(timeout=3)
except Exception as e:
print(f"Warning: aria2process wait failed: {e}")
time.sleep(0.5)
try:
state.aria2process = main.run_aria2server()
except Exception as e:
print(f"Error: failed to restart aria2server: {e}")
return
try:
signal.signal(signal.SIGINT, main.keyboardinterrupthandler)
atexit.unregister(main.kill_aria2server)
atexit.register(main.kill_aria2server)
except Exception as e:
print(f"Warning: signal/atexit setup failed: {e}")
def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_path=None, speed_limit=None, version=None):
def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_path=None, speed_limit=None):
if thread_count is not None:
state.aria2_threads = thread_count
if apiurl is not None:
@@ -42,8 +22,6 @@ def save_settings(thread_count=None, close=lambda: None, apiurl=None, download_p
state.download_path = download_path
if speed_limit is not None:
state.speed_limit = speed_limit
if version is not None:
state.version = version
create_config()
restart_aria2c()
+1
View File
@@ -10,6 +10,7 @@ class AppState:
post_author: List[str]
downloads: List[str]
version: str
ignore_updates: bool = False
debug: bool = False
tracker: str = "rutracker"
api_url: str = "https://api.michijackson.xyz"
+36
View File
@@ -0,0 +1,36 @@
import requests
from core.utils.data.state import state
def check_for_updates():
url = f"https://api.github.com/repos/KeksPirates/SoftwareManager/releases"
response = requests.get(url)
if response.status_code != 200:
print(f"Failed to fetch releases: {response.status_code}")
exit(1)
releases = response.json()
releases.sort(key=lambda r: r["published_at"], reverse=True)
latest_release = releases[0]
latest_version = latest_release["name"]
assets = latest_release["assets"]
if state.version == "dev":
if state.debug:
print("Dev release detected, skipping version check")
return None, None
elif latest_version != state.version:
if state.debug:
print(f"New release available: {latest_version}")
if assets:
if state.debug:
print("Assets:")
for asset in assets:
print(f" - {asset['name']}: {asset['browser_download_url']}")
return assets, latest_version
else:
if state.debug:
print("Already up-to-date.")
return None, None