Refactor yt-dlp update flow and update translations

Replaces manual update check logic in DownloadSettingsDialog with a dedicated YTDLPUpdateDialog for progress tracking. Removes the 'Update yt-dlp' button and related logic from the main window. Updates translation strings in all supported languages to reflect the new update dialog flow and button labeling.
This commit is contained in:
oop7
2025-11-03 18:40:28 +02:00
parent df4a7ab49d
commit d009202230
16 changed files with 34 additions and 82 deletions
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "تحقق عند كل بداية تشغيل (ساعة واحدة على الأقل بين الفحوصات)",
"check_daily": "تحقق يومياً",
"check_weekly": "تحقق أسبوعياً",
"check_updates_now": "تحقق من التحديثات الآن",
"check_updates_now": "تحديث yt-dlp",
"update_check_title": "التحقق من التحديثات",
"could_not_determine_version": "تعذر تحديد الإصدار الحالي لـ yt-dlp.",
"update_available_dialog": "تحديث متاح!\n\nالحالي: {current}\nالأحدث: {latest}\n\nاستخدم زر 'تحديث yt-dlp' في النافذة الرئيسية للتحديث.",
"update_available_dialog": "تحديث متاح!\n\nالحالي: {current}\nالأحدث: {latest}\n\nانقر فوق موافق للمتابعة بالتحديث.",
"up_to_date_dialog": "yt-dlp محدث!\n\nالإصدار الحالي: {version}",
"error_checking_updates": "خطأ في التحقق من التحديثات: {error}",
"settings_saved_title": "تم حفظ الإعدادات",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Bei jedem Start prüfen (mindestens 1 Stunde zwischen Prüfungen)",
"check_daily": "Täglich prüfen",
"check_weekly": "Wöchentlich prüfen",
"check_updates_now": "Jetzt nach Updates suchen",
"check_updates_now": "yt-dlp aktualisieren",
"update_check_title": "Update-Prüfung",
"could_not_determine_version": "Aktuelle yt-dlp-Version konnte nicht bestimmt werden.",
"update_available_dialog": "Update verfügbar!\n\nAktuell: {current}\nNeuest: {latest}\n\nVerwenden Sie die Schaltfläche 'yt-dlp aktualisieren' im Hauptfenster zum Aktualisieren.",
"update_available_dialog": "Update verfügbar!\n\nAktuell: {current}\nNeuest: {latest}\n\nKlicken Sie auf OK, um mit dem Update fortzufahren.",
"up_to_date_dialog": "yt-dlp ist aktuell!\n\nAktuelle Version: {version}",
"error_checking_updates": "Fehler bei der Update-Prüfung: {error}",
"settings_saved_title": "Einstellungen gespeichert",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Check on every startup (minimum 1 hour between checks)",
"check_daily": "Check daily",
"check_weekly": "Check weekly",
"check_updates_now": "Check for Updates Now",
"check_updates_now": "Update yt-dlp",
"update_check_title": "Update Check",
"could_not_determine_version": "Could not determine current yt-dlp version.",
"update_available_dialog": "Update available!\n\nCurrent: {current}\nLatest: {latest}\n\nUse the 'Update yt-dlp' button in the main window to update.",
"update_available_dialog": "Update available!\n\nCurrent: {current}\nLatest: {latest}\n\nClick OK to proceed with the update.",
"up_to_date_dialog": "yt-dlp is up to date!\n\nCurrent version: {version}",
"error_checking_updates": "Error checking for updates: {error}",
"settings_saved_title": "Settings Saved",
+2 -2
View File
@@ -238,10 +238,10 @@
"check_startup": "Verificar en cada inicio (mínimo 1 hora entre verificaciones)",
"check_daily": "Verificar diariamente",
"check_weekly": "Verificar semanalmente",
"check_updates_now": "Verificar Actualizaciones Ahora",
"check_updates_now": "Actualizar yt-dlp",
"update_check_title": "Verificación de Actualizaciones",
"could_not_determine_version": "No se pudo determinar la versión actual de yt-dlp.",
"update_available_dialog": "¡Actualización disponible!\n\nActual: {current}\nÚltima: {latest}\n\nUsa el botón 'Actualizar yt-dlp' en la ventana principal para actualizar.",
"update_available_dialog": "¡Actualización disponible!\n\nActual: {current}\nÚltima: {latest}\n\nHaz clic en Aceptar para continuar con la actualización.",
"up_to_date_dialog": "¡yt-dlp está actualizado!\n\nVersión actual: {version}",
"error_checking_updates": "Error al verificar actualizaciones: {error}",
"settings_saved_title": "Configuración Guardada",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Vérifier à chaque démarrage (minimum 1 heure entre les vérifications)",
"check_daily": "Vérifier quotidiennement",
"check_weekly": "Vérifier hebdomadairement",
"check_updates_now": "Vérifier les mises à jour maintenant",
"check_updates_now": "Mettre à jour yt-dlp",
"update_check_title": "Vérification de mise à jour",
"could_not_determine_version": "Impossible de déterminer la version actuelle de yt-dlp.",
"update_available_dialog": "Mise à jour disponible !\n\nActuelle : {current}\nDernière : {latest}\n\nUtilisez le bouton 'Mettre à jour yt-dlp' dans la fenêtre principale pour mettre à jour.",
"update_available_dialog": "Mise à jour disponible !\n\nActuelle : {current}\nDernière : {latest}\n\nCliquez sur OK pour continuer la mise à jour.",
"up_to_date_dialog": "yt-dlp est à jour !\n\nVersion actuelle : {version}",
"error_checking_updates": "Erreur lors de la vérification des mises à jour : {error}",
"settings_saved_title": "Paramètres sauvegardés",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "हर स्टार्टअप पर जांचें (जांच के बीच कम से कम 1 घंटा)",
"check_daily": "दैनिक जांचें",
"check_weekly": "साप्ताहिक जांचें",
"check_updates_now": "अभी अपडेट की जांच करें",
"check_updates_now": "yt-dlp अपडेट करें",
"update_check_title": "अपडेट जांच",
"could_not_determine_version": "वर्तमान yt-dlp संस्करण निर्धारित नहीं हो सका।",
"update_available_dialog": "अपडेट उपलब्ध!\n\nवर्तमान: {current}\nनवीनतम: {latest}\n\nअपडेट करने के लिए मुख्य विंडो में 'yt-dlp अपडेट करें' बटन का उपयोग करें।",
"update_available_dialog": "अपडेट उपलब्ध!\n\nवर्तमान: {current}\nनवीनतम: {latest}\n\nअपडेट जारी रखने के लिए OK पर क्लिक करें।",
"up_to_date_dialog": "yt-dlp अप टू डेट है!\n\nवर्तमान संस्करण: {version}",
"error_checking_updates": "अपडेट जांचने में त्रुटि: {error}",
"settings_saved_title": "सेटिंग्स सेव की गईं",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Periksa setiap startup (minimal 1 jam antara pemeriksaan)",
"check_daily": "Periksa harian",
"check_weekly": "Periksa mingguan",
"check_updates_now": "Periksa pembaruan sekarang",
"check_updates_now": "Perbarui yt-dlp",
"update_check_title": "Pemeriksaan pembaruan",
"could_not_determine_version": "Tidak dapat menentukan versi yt-dlp saat ini.",
"update_available_dialog": "Pembaruan tersedia!\n\nSaat ini: {current}\nTerbaru: {latest}\n\nGunakan tombol 'Perbarui yt-dlp' di jendela utama untuk memperbarui.",
"update_available_dialog": "Pembaruan tersedia!\n\nSaat ini: {current}\nTerbaru: {latest}\n\nKlik OK untuk melanjutkan pembaruan.",
"up_to_date_dialog": "yt-dlp sudah terbaru!\n\nVersi saat ini: {version}",
"error_checking_updates": "Kesalahan memeriksa pembaruan: {error}",
"settings_saved_title": "Pengaturan disimpan",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Controlla ad ogni avvio (minimo 1 ora tra i controlli)",
"check_daily": "Controlla giornalmente",
"check_weekly": "Controlla settimanalmente",
"check_updates_now": "Controlla aggiornamenti ora",
"check_updates_now": "Aggiorna yt-dlp",
"update_check_title": "Controllo aggiornamenti",
"could_not_determine_version": "Impossibile determinare la versione corrente di yt-dlp.",
"update_available_dialog": "Aggiornamento disponibile!\n\nCorrente: {current}\nUltima: {latest}\n\nUsa il pulsante 'Aggiorna yt-dlp' nella finestra principale per aggiornare.",
"update_available_dialog": "Aggiornamento disponibile!\n\nCorrente: {current}\nUltima: {latest}\n\nClicca su OK per procedere con l'aggiornamento.",
"up_to_date_dialog": "yt-dlp è aggiornato!\n\nVersione corrente: {version}",
"error_checking_updates": "Errore nel controllo aggiornamenti: {error}",
"settings_saved_title": "Impostazioni salvate",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "起動時に毎回確認 (チェック間隔は最低1時間)",
"check_daily": "毎日確認",
"check_weekly": "毎週確認",
"check_updates_now": "今すぐ更新を確認",
"check_updates_now": "yt-dlpを更新",
"update_check_title": "更新確認",
"could_not_determine_version": "yt-dlpの現在のバージョンを確認できませんでした。",
"update_available_dialog": "アップデートが利用可能です!\n\n現在: {current}\n最新: {latest}\n\nメインウィンドウの「yt-dlpを更新」ボタンを使用して更新してください。",
"update_available_dialog": "アップデートが利用可能です!\n\n現在: {current}\n最新: {latest}\n\nOKをクリックして更新を続行します。",
"up_to_date_dialog": "yt-dlpは最新です!\n\n現在のバージョン: {version}",
"error_checking_updates": "更新確認エラー: {error}",
"settings_saved_title": "設定を保存しました",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Sprawdzaj przy każdym uruchomieniu (minimum 1 godzina między sprawdzeniami)",
"check_daily": "Sprawdzaj codziennie",
"check_weekly": "Sprawdzaj co tydzień",
"check_updates_now": "Sprawdź aktualizacje teraz",
"check_updates_now": "Zaktualizuj yt-dlp",
"update_check_title": "Sprawdzanie aktualizacji",
"could_not_determine_version": "Nie można określić aktualnej wersji yt-dlp.",
"update_available_dialog": "Dostępna aktualizacja!\n\nAktualna: {current}\nNajnowsza: {latest}\n\nUżyj przycisku 'Zaktualizuj yt-dlp' w głównym oknie, aby zaktualizować.",
"update_available_dialog": "Dostępna aktualizacja!\n\nAktualna: {current}\nNajnowsza: {latest}\n\nKliknij OK, aby kontynuować aktualizację.",
"up_to_date_dialog": "yt-dlp jest aktualny!\n\nAktualna wersja: {version}",
"error_checking_updates": "Błąd sprawdzania aktualizacji: {error}",
"settings_saved_title": "Ustawienia zapisane",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Verificar a cada inicialização (mínimo 1 hora entre verificações)",
"check_daily": "Verificar diariamente",
"check_weekly": "Verificar semanalmente",
"check_updates_now": "Verificar Atualizações Agora",
"check_updates_now": "Atualizar yt-dlp",
"update_check_title": "Verificação de Atualização",
"could_not_determine_version": "Não foi possível determinar a versão atual do yt-dlp.",
"update_available_dialog": "Atualização disponível!\n\nAtual: {current}\nÚltima: {latest}\n\nUse o botão 'Atualizar yt-dlp' na janela principal para atualizar.",
"update_available_dialog": "Atualização disponível!\n\nAtual: {current}\nÚltima: {latest}\n\nClique em OK para continuar com a atualização.",
"up_to_date_dialog": "yt-dlp está atualizado!\n\nVersão atual: {version}",
"error_checking_updates": "Erro ao verificar atualizações: {error}",
"settings_saved_title": "Configurações Salvas",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Проверять при каждом запуске (минимум 1 час между проверками)",
"check_daily": "Проверять ежедневно",
"check_weekly": "Проверять еженедельно",
"check_updates_now": "Проверить обновления сейчас",
"check_updates_now": "Обновить yt-dlp",
"update_check_title": "Проверка обновлений",
"could_not_determine_version": "Не удалось определить текущую версию yt-dlp.",
"update_available_dialog": "Доступно обновление!\n\nТекущая: {current}\nПоследняя: {latest}\n\nИспользуйте кнопку 'Обновить yt-dlp' в главном окне для обновления.",
"update_available_dialog": "Доступно обновление!\n\nТекущая: {current}\nПоследняя: {latest}\n\nНажмите OK для продолжения обновления.",
"up_to_date_dialog": "yt-dlp актуален!\n\nТекущая версия: {version}",
"error_checking_updates": "Ошибка проверки обновлений: {error}",
"settings_saved_title": "Настройки сохранены",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "Her başlangıçta kontrol et (kontroller arası en az 1 saat)",
"check_daily": "Günlük kontrol et",
"check_weekly": "Haftalık kontrol et",
"check_updates_now": "Şimdi güncellemeleri kontrol et",
"check_updates_now": "yt-dlp'yi güncelle",
"update_check_title": "Güncelleme kontrolü",
"could_not_determine_version": "Mevcut yt-dlp sürümü belirlenemedi.",
"update_available_dialog": "Güncelleme mevcut!\n\nMevcut: {current}\nEn son: {latest}\n\nGüncellemek için ana penceredeki 'yt-dlp'yi güncelle' düğmesini kullanın.",
"update_available_dialog": "Güncelleme mevcut!\n\nMevcut: {current}\nEn son: {latest}\n\nGüncellemeye devam etmek için Tamam'a tıklayın.",
"up_to_date_dialog": "yt-dlp güncel!\n\nMevcut sürüm: {version}",
"error_checking_updates": "Güncelleme kontrol hatası: {error}",
"settings_saved_title": "Ayarlar kaydedildi",
+2 -2
View File
@@ -255,10 +255,10 @@
"check_startup": "每次启动时检查(检查间隔最少 1 小时)",
"check_daily": "每日检查",
"check_weekly": "每周检查",
"check_updates_now": "立即检查更新",
"check_updates_now": "更新 yt-dlp",
"update_check_title": "更新检查",
"could_not_determine_version": "无法确定当前 yt-dlp 版本。",
"update_available_dialog": "有可用更新!\\n\\n当前:{current}\\n最新:{latest}\\n\\n使用主窗口中的'更新 yt-dlp'按钮进行更新。",
"update_available_dialog": "有可用更新!\\n\\n当前:{current}\\n最新:{latest}\\n\\n点击确定继续更新。",
"up_to_date_dialog": "yt-dlp 已是最新版本!\n\n当前版本:{version}",
"error_checking_updates": "检查更新时出错:{error}",
"settings_saved_title": "设置已保存",
@@ -33,6 +33,7 @@ from src.core.ytsage_utils import (
get_ytdlp_version,
update_auto_update_settings,
)
from src.gui.ytsage_gui_dialogs.ytsage_dialogs_update import YTDLPUpdateDialog
from src.utils.ytsage_logger import logger
from src.utils.ytsage_localization import _
@@ -313,49 +314,11 @@ class DownloadSettingsDialog(QDialog):
return msg_box
def test_update_check(self) -> None:
"""Test the update check functionality."""
try:
# Get current version
current_version = get_ytdlp_version()
if "Error" in current_version:
msg_box = self._create_styled_message_box(
QMessageBox.Icon.Warning,
_("settings.update_check_title"),
_("settings.could_not_determine_version"),
)
msg_box.exec()
return
# Get latest version from PyPI
response = requests.get("https://pypi.org/pypi/yt-dlp/json", timeout=10)
response.raise_for_status()
latest_version = response.json()["info"]["version"]
# Clean up version strings
current_version = current_version.replace("_", ".")
latest_version = latest_version.replace("_", ".")
if version_parser.parse(latest_version) > version_parser.parse(current_version):
msg_box = self._create_styled_message_box(
QMessageBox.Icon.Information,
_("settings.update_check_title"),
_("settings.update_available_dialog", current=current_version, latest=latest_version),
)
msg_box.exec()
else:
msg_box = self._create_styled_message_box(
QMessageBox.Icon.Information,
_("settings.update_check_title"),
_("settings.up_to_date_dialog", version=current_version),
)
msg_box.exec()
except Exception as e:
msg_box = self._create_styled_message_box(
QMessageBox.Icon.Warning,
_("settings.update_check_title"),
_("settings.error_checking_updates", error=str(e)),
)
msg_box.exec()
"""Open the yt-dlp update dialog with proper progress tracking."""
# Create and show the update dialog (non-modal to prevent blocking)
dialog = YTDLPUpdateDialog(self)
dialog.setModal(False) # Make it non-modal
dialog.show() # Use show() instead of exec() to avoid blocking
def get_auto_update_settings(self) -> tuple[bool, str]:
"""Returns the auto-update settings from the dialog."""
-11
View File
@@ -581,9 +581,6 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
self.time_range_btn = QPushButton(_("buttons.trim_video"))
self.time_range_btn.clicked.connect(self.show_time_range_dialog)
self.update_ytdlp_btn = QPushButton(_("buttons.update"))
self.update_ytdlp_btn.clicked.connect(self.update_ytdlp)
# --- Rename Path Button to Settings Button ---
self.settings_button = QPushButton(_("buttons.download_settings")) # Renamed button
self.settings_button.clicked.connect(self.show_download_settings_dialog) # Renamed method
@@ -607,7 +604,6 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
download_layout.addWidget(self.about_btn)
download_layout.addWidget(self.history_btn)
download_layout.addWidget(self.time_range_btn) # New button position
download_layout.addWidget(self.update_ytdlp_btn)
download_layout.addWidget(self.settings_button)
download_layout.addWidget(self.download_btn)
download_layout.addWidget(self.pause_btn)
@@ -748,13 +744,6 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
clipboard = QApplication.clipboard()
self.url_input.setText(clipboard.text())
def update_ytdlp(self) -> None:
"""Show the yt-dlp update dialog with proper progress tracking"""
# Make the dialog non-modal to prevent blocking the main UI
dialog = YTDLPUpdateDialog(self)
dialog.setModal(False) # Make it non-modal
dialog.show() # Use show() instead of exec() to avoid blocking
def show_download_settings_dialog(self) -> None: # Renamed method
dialog = DownloadSettingsDialog(self.last_path, self.speed_limit_value, self.speed_limit_unit_index, self)
if dialog.exec():