Update Application Initialization with yt-dlp Checks

This commit is contained in:
Your Name
2025-07-04 21:32:00 +03:00
parent 1cc16cab5d
commit 03a210507d
+10 -8
View File
@@ -1,7 +1,7 @@
import sys import sys
from PySide6.QtWidgets import QApplication, QMessageBox from PySide6.QtWidgets import QApplication, QMessageBox
from ytsage_gui_main import YTSageApp # Import the main application class from ytsage_gui_main from ytsage_gui_main import YTSageApp # Import the main application class from ytsage_gui_main
from ytsage_utils import update_yt_dlp # Import the update function from ytsage_yt_dlp import check_ytdlp_binary, setup_ytdlp, get_ytdlp_executable_path # Import the new yt-dlp setup functions
def show_error_dialog(message): def show_error_dialog(message):
error_dialog = QMessageBox() error_dialog = QMessageBox()
@@ -13,14 +13,16 @@ def show_error_dialog(message):
def main(): def main():
try: try:
# Try to update yt-dlp before starting the app
try:
update_yt_dlp()
except Exception as e:
print(f"Warning: Could not update yt-dlp: {e}")
# Continue with application startup even if the update fails
app = QApplication(sys.argv) app = QApplication(sys.argv)
# Get the expected binary path and check if it exists
expected_path = get_ytdlp_executable_path()
if not check_ytdlp_binary():
# No app-specific binary found, show setup dialog regardless of Python package
yt_dlp_path = setup_ytdlp()
if yt_dlp_path == "yt-dlp": # If user canceled or something went wrong
print(f"Warning: yt-dlp not configured properly")
window = YTSageApp() # Instantiate the main application class window = YTSageApp() # Instantiate the main application class
window.show() window.show()
sys.exit(app.exec()) sys.exit(app.exec())