Add update-in-progress handling and translations

Introduces 'update in progress' messages to all supported languages and updates the GUI to prevent analysis or downloads while yt-dlp is updating. Adds flags to track update and analysis states, ensuring user actions are blocked with appropriate warnings during updates.
This commit is contained in:
oop7
2025-12-09 20:53:20 +02:00
parent b70dfb58e7
commit d45a4a35a4
15 changed files with 63 additions and 14 deletions
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ تم تحديث yt-dlp بنجاح!",
"already_latest": "yt-dlp محدث (الإصدار {version})",
"network_error": "❌ خطأ في الشبكة أثناء التحديث: {error}",
"general_error": "❌ فشل التحديث: {error}"
"general_error": "❌ فشل التحديث: {error}",
"update_in_progress_title": "التحديث قيد التقدم",
"update_in_progress_message": "يتم تحديث yt-dlp حاليًا. يرجى الانتظار لحظة."
},
"about": {
"title": "حول YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp wurde erfolgreich aktualisiert!",
"already_latest": "yt-dlp ist auf dem neuesten Stand (Version {version})",
"network_error": "❌ Netzwerkfehler während des Updates: {error}",
"general_error": "❌ Update fehlgeschlagen: {error}"
"general_error": "❌ Update fehlgeschlagen: {error}",
"update_in_progress_title": "Update läuft",
"update_in_progress_message": "yt-dlp wird gerade aktualisiert. Bitte warten Sie einen Moment."
},
"about": {
"title": "Über YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp has been successfully updated!",
"already_latest": "yt-dlp is up to date (version {version})",
"network_error": "❌ Network error during update: {error}",
"general_error": "❌ Update failed: {error}"
"general_error": "❌ Update failed: {error}",
"update_in_progress_title": "Update in Progress",
"update_in_progress_message": "yt-dlp is currently updating. Please wait a moment."
},
"about": {
"title": "About YTSage",
+3 -1
View File
@@ -225,7 +225,9 @@
"update_success": "✅ ¡yt-dlp se ha actualizado exitosamente!",
"already_latest": "yt-dlp está actualizado (versión {version})",
"network_error": "❌ Error de red durante la actualización: {error}",
"general_error": "❌ La actualización falló: {error}"
"general_error": "❌ La actualización falló: {error}",
"update_in_progress_title": "Actualización en curso",
"update_in_progress_message": "yt-dlp se está actualizando actualmente. Por favor espere un momento."
},
"settings": {
"title": "Configuración de Descarga",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp a été mis à jour avec succès !",
"already_latest": "yt-dlp est à jour (version {version})",
"network_error": "❌ Erreur réseau pendant la mise à jour : {error}",
"general_error": "❌ La mise à jour a échoué : {error}"
"general_error": "❌ La mise à jour a échoué : {error}",
"update_in_progress_title": "Mise à jour en cours",
"update_in_progress_message": "yt-dlp est en cours de mise à jour. Veuillez patienter un instant."
},
"about": {
"title": "À propos de YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp सफलतापूर्वक अपडेट किया गया है!",
"already_latest": "yt-dlp अप टू डेट है (संस्करण {version})",
"network_error": "❌ अपडेट के दौरान नेटवर्क त्रुटि: {error}",
"general_error": "❌ अपडेट असफल: {error}"
"general_error": "❌ अपडेट असफल: {error}",
"update_in_progress_title": "अपडेट जारी है",
"update_in_progress_message": "yt-dlp अभी अपडेट हो रहा है। कृपया कुछ देर प्रतीक्षा करें।"
},
"about": {
"title": "YTSage के बारे में",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp telah berhasil diperbarui!",
"already_latest": "yt-dlp sudah terbaru (versi {version})",
"network_error": "❌ Kesalahan jaringan selama pembaruan: {error}",
"general_error": "❌ Pembaruan gagal: {error}"
"general_error": "❌ Pembaruan gagal: {error}",
"update_in_progress_title": "Pembaruan Sedang Berlangsung",
"update_in_progress_message": "yt-dlp sedang diperbarui. Mohon tunggu sebentar."
},
"about": {
"title": "Tentang YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp è stato aggiornato con successo!",
"already_latest": "yt-dlp è aggiornato (versione {version})",
"network_error": "❌ Errore di rete durante l'aggiornamento: {error}",
"general_error": "❌ Aggiornamento fallito: {error}"
"general_error": "❌ Aggiornamento fallito: {error}",
"update_in_progress_title": "Aggiornamento in corso",
"update_in_progress_message": "yt-dlp si sta aggiornando. Attendere prego."
},
"about": {
"title": "Informazioni su YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlpが正常に更新されました!",
"already_latest": "yt-dlpは最新です(バージョン {version}",
"network_error": "❌ 更新中にネットワークエラーが発生しました: {error}",
"general_error": "❌ 更新に失敗しました: {error}"
"general_error": "❌ 更新に失敗しました: {error}",
"update_in_progress_title": "更新中",
"update_in_progress_message": "yt-dlpを更新中です。少々お待ちください。"
},
"about": {
"title": "YTSageについて",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp został pomyślnie zaktualizowany!",
"already_latest": "yt-dlp jest aktualny (wersja {version})",
"network_error": "❌ Błąd sieci podczas aktualizacji: {error}",
"general_error": "❌ Aktualizacja nie powiodła się: {error}"
"general_error": "❌ Aktualizacja nie powiodła się: {error}",
"update_in_progress_title": "Trwa aktualizacja",
"update_in_progress_message": "Trwa aktualizacja yt-dlp. Proszę chwilę zaczekać."
},
"about": {
"title": "O YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp foi atualizado com sucesso!",
"already_latest": "yt-dlp está atualizado (versão {version})",
"network_error": "❌ Erro de rede durante a atualização: {error}",
"general_error": "❌ A atualização falhou: {error}"
"general_error": "❌ A atualização falhou: {error}",
"update_in_progress_title": "Atualização em andamento",
"update_in_progress_message": "O yt-dlp está sendo atualizado. Por favor, aguarde um momento."
},
"about": {
"title": "Sobre YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp был успешно обновлен!",
"already_latest": "yt-dlp актуален (версия {version})",
"network_error": "❌ Ошибка сети во время обновления: {error}",
"general_error": "❌ Обновление не удалось: {error}"
"general_error": "❌ Обновление не удалось: {error}",
"update_in_progress_title": "Идет обновление",
"update_in_progress_message": "yt-dlp обновляется. Пожалуйста, подождите."
},
"about": {
"title": "О YTSage",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp başarıyla güncellendi!",
"already_latest": "yt-dlp güncel (sürüm {version})",
"network_error": "❌ Güncelleme sırasında ağ hatası: {error}",
"general_error": "❌ Güncelleme başarısız: {error}"
"general_error": "❌ Güncelleme başarısız: {error}",
"update_in_progress_title": "Güncelleme Devam Ediyor",
"update_in_progress_message": "yt-dlp şu anda güncelleniyor. Lütfen bir dakika bekleyin."
},
"about": {
"title": "YTSage Hakkında",
+3 -1
View File
@@ -212,7 +212,9 @@
"update_success": "✅ yt-dlp 已成功更新!",
"already_latest": "yt-dlp 是最新版本(版本 {version}",
"network_error": "❌ 更新期间网络错误:{error}",
"general_error": "❌ 更新失败:{error}"
"general_error": "❌ 更新失败:{error}",
"update_in_progress_title": "正在更新",
"update_in_progress_message": "yt-dlp 正在更新中。请稍候。"
},
"about": {
"title": "关于 YTSage",
+21
View File
@@ -96,6 +96,8 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
self.download_paused = False
self.current_download = None
self.download_cancelled = False
self.is_updating_ytdlp = False # Initialize update flag
self.is_analyzing = False # Initialize analysis flag
self.save_thumbnail = False # Initialize thumbnail state
self.thumbnail_url = None # Add this to store thumbnail URL
self.all_formats = [] # Initialize all_formats
@@ -784,6 +786,10 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
self.analyze_button.setEnabled(bool(text.strip()))
def analyze_url(self) -> None:
if self.is_updating_ytdlp:
QMessageBox.warning(self, _("update.update_in_progress_title"), _("update.update_in_progress_message"))
return
url = self.url_input.text().strip()
if not url:
self.signals.update_status.emit(_("main_ui.invalid_url_or_enter"))
@@ -800,6 +806,7 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
self.toggle_analysis_dependent_controls(enabled=False)
self.signals.update_status.emit(_("main_ui.analyzing_preparing"))
self.is_analyzing = True
threading.Thread(target=self._analyze_url_thread, args=(url,), daemon=True).start()
def _analyze_url_thread(self, url) -> None:
@@ -821,6 +828,8 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
# update signal method from QMetaObject.invokeMethod to signals
self.signals.playlist_info_label_visible.emit(False)
self.signals.playlist_select_btn_visible.emit(False)
finally:
self.is_analyzing = False
def paste_url(self) -> None:
clipboard = QApplication.clipboard()
@@ -878,6 +887,10 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
self.settings_button.setToolTip(f"Current Path: {self.last_path}\nSpeed Limit: {limit_text}")
def start_download(self) -> None:
if self.is_updating_ytdlp:
QMessageBox.warning(self, _("update.update_in_progress_title"), _("update.update_in_progress_message"))
return
url = self.url_input.text().strip()
# --- Use self.last_path instead of reading from QLineEdit ---
path = self.last_path
@@ -1383,16 +1396,24 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
def _perform_auto_update(self) -> None:
"""Actually perform the auto-update check and update if needed in a background thread."""
# Check if a download is currently running or analysis is in progress
if (self.current_download and self.current_download.isRunning()) or self.is_analyzing:
logger.info("Download or analysis in progress, skipping auto-update check.")
return
try:
self.is_updating_ytdlp = True # Set flag
# Create and start the auto-update thread to avoid blocking the UI
self.auto_update_thread = AutoUpdateThread()
self.auto_update_thread.update_finished.connect(self._on_auto_update_finished)
self.auto_update_thread.start()
except Exception as e:
self.is_updating_ytdlp = False # Reset flag on error
logger.exception(f"Error starting auto-update thread: {e}")
def _on_auto_update_finished(self, success, message) -> None:
self.is_updating_ytdlp = False # Reset flag
"""Handle auto-update completion."""
if success:
logger.info(f"Auto-update completed successfully: {message}")