From 0d5cbb2df1ce5e19dc28c4fd0f47789c89aaf071 Mon Sep 17 00:00:00 2001 From: oop7 <110548351+oop7@users.noreply.github.com> Date: Fri, 1 May 2026 16:49:58 +0300 Subject: [PATCH] Write auto-subs only if selected; show count Downloader: add detection for "Auto-generated" subtitle selection and only append --write-auto-subs when an auto-generated subtitle is explicitly chosen (prevents always enabling the flag when any subtitles are requested). GUI: update subtitle label to display the number of selected subtitles when >0, falling back to the zero-selected message otherwise. Small UX and behavior fixes in DownloadThread and AnalysisMixin. --- ytsage/core/ytsage_downloader.py | 6 +++++- ytsage/gui/ytsage_gui_analysis.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ytsage/core/ytsage_downloader.py b/ytsage/core/ytsage_downloader.py index 941c930..d44b121 100644 --- a/ytsage/core/ytsage_downloader.py +++ b/ytsage/core/ytsage_downloader.py @@ -352,17 +352,21 @@ class DownloadThread(QThread): # Get language codes from subtitle selections lang_codes: List[str] = [] + has_auto_generated = False for sub_selection in self.subtitle_langs: try: # Extract just the language code (e.g., 'en' from 'en - Manual') lang_code = sub_selection.split(" - ")[0] lang_codes.append(lang_code) + if "Auto-generated" in sub_selection: + has_auto_generated = True except Exception as e: logger.exception(f"Could not parse subtitle selection '{sub_selection}': {e}") if lang_codes: cmd.extend(["--sub-langs", ",".join(lang_codes)]) - cmd.append("--write-auto-subs") # Include auto-generated subtitles + if has_auto_generated: + cmd.append("--write-auto-subs") # Include auto-generated subtitles # Only embed subtitles if merge is enabled if self.merge_subs: diff --git a/ytsage/gui/ytsage_gui_analysis.py b/ytsage/gui/ytsage_gui_analysis.py index 9f5a33d..5bdd095 100644 --- a/ytsage/gui/ytsage_gui_analysis.py +++ b/ytsage/gui/ytsage_gui_analysis.py @@ -435,7 +435,11 @@ class AnalysisMixin: self.download_thumbnail_file(self.video_url, self.last_path) # Update subtitle UI - self.signals.selected_subs_label_text.emit(_("main_ui.zero_selected")) + count = len(self.selected_subtitles) + if count > 0: + self.signals.selected_subs_label_text.emit(_("subtitle_selection.count_selected", count=count)) + else: + self.signals.selected_subs_label_text.emit(_("main_ui.zero_selected")) # Update format table self.video_button.setChecked(True)