Add audio format selection for audio-only downloads
Introduces settings and UI for forcing audio format conversion on audio-only downloads, including support for selecting preferred audio formats. Updates language files for all supported languages, adds config options, and passes new settings through the downloader and main app logic.
This commit is contained in:
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "عند التمكين، سيتم تحويل الفيديوهات المدموجة إلى تنسيقك المفضل. قم بالتعطيل للسماح لـ yt-dlp بالقرار تلقائياً.",
|
||||
"format_mp4": "MP4 (الأكثر توافقاً)",
|
||||
"format_webm": "WebM (حديث، مفتوح)",
|
||||
"format_mkv": "MKV (غني بالميزات)"
|
||||
"format_mkv": "MKV (غني بالميزات)",
|
||||
"audio_format_settings": "إعدادات تنسيق الصوت",
|
||||
"force_audio_format": "فرض تنسيق الصوت لتنزيلات الصوت فقط",
|
||||
"preferred_audio_format": "تنسيق الصوت المفضل:",
|
||||
"force_audio_format_help": "عند التمكين، سيتم تحويل تنزيلات الصوت فقط إلى التنسيق المفضل لديك. هذا ينطبق فقط عند تنزيل تنسيقات الصوت.",
|
||||
"audio_format_best": "الأفضل (بدون تحويل)",
|
||||
"audio_format_aac": "AAC (جيد للتحرير)",
|
||||
"audio_format_mp3": "MP3 (عالمي)",
|
||||
"audio_format_flac": "FLAC (بدون فقدان)",
|
||||
"audio_format_wav": "WAV (غير مضغوط)",
|
||||
"audio_format_opus": "Opus (فعال)",
|
||||
"audio_format_m4a": "M4A (أبل)",
|
||||
"audio_format_vorbis": "Vorbis (مفتوح)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "أدخل رابط فيديو يوتيوب أو قائمة تشغيل",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Wenn aktiviert, werden zusammengeführte Videos in Ihr bevorzugtes Format konvertiert. Deaktivieren Sie diese Option, damit yt-dlp automatisch entscheidet.",
|
||||
"format_mp4": "MP4 (Am kompatibelsten)",
|
||||
"format_webm": "WebM (Modern, offen)",
|
||||
"format_mkv": "MKV (Funktionsreich)"
|
||||
"format_mkv": "MKV (Funktionsreich)",
|
||||
"audio_format_settings": "Audioformat-Einstellungen",
|
||||
"force_audio_format": "Audioformat für Nur-Audio-Downloads erzwingen",
|
||||
"preferred_audio_format": "Bevorzugtes Audioformat:",
|
||||
"force_audio_format_help": "Wenn aktiviert, werden Nur-Audio-Downloads in Ihr bevorzugtes Format konvertiert. Dies gilt nur beim Herunterladen von Audioformaten.",
|
||||
"audio_format_best": "Beste (Keine Konvertierung)",
|
||||
"audio_format_aac": "AAC (Gut zum Bearbeiten)",
|
||||
"audio_format_mp3": "MP3 (Universal)",
|
||||
"audio_format_flac": "FLAC (Verlustfrei)",
|
||||
"audio_format_wav": "WAV (Unkomprimiert)",
|
||||
"audio_format_opus": "Opus (Effizient)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Offen)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "YouTube-Video- oder Playlist-URL eingeben",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "When enabled, merged videos will be converted to your preferred format. Disable to let yt-dlp decide automatically.",
|
||||
"format_mp4": "MP4 (Most compatible)",
|
||||
"format_webm": "WebM (Modern, open)",
|
||||
"format_mkv": "MKV (Feature-rich)"
|
||||
"format_mkv": "MKV (Feature-rich)",
|
||||
"audio_format_settings": "Audio Format Settings",
|
||||
"force_audio_format": "Force audio format for audio-only downloads",
|
||||
"preferred_audio_format": "Preferred audio format:",
|
||||
"force_audio_format_help": "When enabled, audio-only downloads will be converted to your preferred format. This only applies when downloading audio formats.",
|
||||
"audio_format_best": "Best (No conversion)",
|
||||
"audio_format_aac": "AAC (Good for editing)",
|
||||
"audio_format_mp3": "MP3 (Universal)",
|
||||
"audio_format_flac": "FLAC (Lossless)",
|
||||
"audio_format_wav": "WAV (Uncompressed)",
|
||||
"audio_format_opus": "Opus (Efficient)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Open)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Enter YouTube video or playlist URL",
|
||||
|
||||
+13
-1
@@ -276,7 +276,19 @@
|
||||
"force_format_help": "Cuando está habilitado, los videos combinados se convertirán a su formato preferido. Deshabilitar para dejar que yt-dlp decida automáticamente.",
|
||||
"format_mp4": "MP4 (Más compatible)",
|
||||
"format_webm": "WebM (Moderno, abierto)",
|
||||
"format_mkv": "MKV (Rico en funciones)"
|
||||
"format_mkv": "MKV (Rico en funciones)",
|
||||
"audio_format_settings": "Configuración de formato de audio",
|
||||
"force_audio_format": "Forzar formato de audio para descargas solo de audio",
|
||||
"preferred_audio_format": "Formato de audio preferido:",
|
||||
"force_audio_format_help": "Cuando está habilitado, las descargas solo de audio se convertirán a su formato preferido. Esto solo se aplica al descargar formatos de audio.",
|
||||
"audio_format_best": "Mejor (Sin conversión)",
|
||||
"audio_format_aac": "AAC (Bueno para edición)",
|
||||
"audio_format_mp3": "MP3 (Universal)",
|
||||
"audio_format_flac": "FLAC (Sin pérdida)",
|
||||
"audio_format_wav": "WAV (Sin comprimir)",
|
||||
"audio_format_opus": "Opus (Eficiente)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Abierto)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Ingresa URL de video o lista de YouTube",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Lorsqu'activé, les vidéos fusionnées seront converties vers votre format préféré. Désactivez pour laisser yt-dlp décider automatiquement.",
|
||||
"format_mp4": "MP4 (Plus compatible)",
|
||||
"format_webm": "WebM (Moderne, ouvert)",
|
||||
"format_mkv": "MKV (Riche en fonctionnalités)"
|
||||
"format_mkv": "MKV (Riche en fonctionnalités)",
|
||||
"audio_format_settings": "Paramètres du format audio",
|
||||
"force_audio_format": "Forcer le format audio pour les téléchargements audio uniquement",
|
||||
"preferred_audio_format": "Format audio préféré :",
|
||||
"force_audio_format_help": "Lorsqu'activé, les téléchargements audio uniquement seront convertis dans votre format préféré. Cela s'applique uniquement lors du téléchargement de formats audio.",
|
||||
"audio_format_best": "Meilleur (Pas de conversion)",
|
||||
"audio_format_aac": "AAC (Bon pour l'édition)",
|
||||
"audio_format_mp3": "MP3 (Universel)",
|
||||
"audio_format_flac": "FLAC (Sans perte)",
|
||||
"audio_format_wav": "WAV (Non compressé)",
|
||||
"audio_format_opus": "Opus (Efficace)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Ouvert)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Entrer l'URL de la vidéo ou de la playlist YouTube",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "सक्षम होने पर, मर्ज किए गए वीडियो आपके पसंदीदा प्रारूप में परिवर्तित हो जाएंगे। yt-dlp को स्वचालित रूप से निर्णय लेने देने के लिए अक्षम करें।",
|
||||
"format_mp4": "MP4 (सबसे संगत)",
|
||||
"format_webm": "WebM (आधुनिक, खुला)",
|
||||
"format_mkv": "MKV (सुविधा समृद्ध)"
|
||||
"format_mkv": "MKV (सुविधा समृद्ध)",
|
||||
"audio_format_settings": "ऑडियो प्रारूप सेटिंग्स",
|
||||
"force_audio_format": "केवल ऑडियो डाउनलोड के लिए ऑडियो प्रारूप लागू करें",
|
||||
"preferred_audio_format": "पसंदीदा ऑडियो प्रारूप:",
|
||||
"force_audio_format_help": "सक्षम होने पर, केवल ऑडियो डाउनलोड आपके पसंदीदा प्रारूप में परिवर्तित हो जाएंगे। यह केवल ऑडियो प्रारूप डाउनलोड करते समय लागू होता है।",
|
||||
"audio_format_best": "सर्वोत्तम (कोई परिवर्तन नहीं)",
|
||||
"audio_format_aac": "AAC (संपादन के लिए अच्छा)",
|
||||
"audio_format_mp3": "MP3 (सार्वभौमिक)",
|
||||
"audio_format_flac": "FLAC (हानिरहित)",
|
||||
"audio_format_wav": "WAV (असंकुचित)",
|
||||
"audio_format_opus": "Opus (कुशल)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (खुला)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "YouTube वीडियो या प्लेलिस्ट URL दर्ज करें",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Jika diaktifkan, video yang digabungkan akan dikonversi ke format pilihan Anda. Nonaktifkan untuk membiarkan yt-dlp memutuskan secara otomatis.",
|
||||
"format_mp4": "MP4 (Paling kompatibel)",
|
||||
"format_webm": "WebM (Modern, terbuka)",
|
||||
"format_mkv": "MKV (Kaya fitur)"
|
||||
"format_mkv": "MKV (Kaya fitur)",
|
||||
"audio_format_settings": "Pengaturan Format Audio",
|
||||
"force_audio_format": "Paksa format audio untuk unduhan khusus audio",
|
||||
"preferred_audio_format": "Format audio pilihan:",
|
||||
"force_audio_format_help": "Saat diaktifkan, unduhan khusus audio akan dikonversi ke format pilihan Anda. Ini hanya berlaku saat mengunduh format audio.",
|
||||
"audio_format_best": "Terbaik (Tanpa konversi)",
|
||||
"audio_format_aac": "AAC (Bagus untuk editing)",
|
||||
"audio_format_mp3": "MP3 (Universal)",
|
||||
"audio_format_flac": "FLAC (Lossless)",
|
||||
"audio_format_wav": "WAV (Tidak terkompresi)",
|
||||
"audio_format_opus": "Opus (Efisien)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Terbuka)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Masukkan URL video atau playlist YouTube",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Quando attivato, i video uniti verranno convertiti nel formato preferito. Disattiva per lasciare che yt-dlp decida automaticamente.",
|
||||
"format_mp4": "MP4 (Più compatibile)",
|
||||
"format_webm": "WebM (Moderno, aperto)",
|
||||
"format_mkv": "MKV (Ricco di funzionalità)"
|
||||
"format_mkv": "MKV (Ricco di funzionalità)",
|
||||
"audio_format_settings": "Impostazioni formato audio",
|
||||
"force_audio_format": "Forza formato audio per download solo audio",
|
||||
"preferred_audio_format": "Formato audio preferito:",
|
||||
"force_audio_format_help": "Quando abilitato, i download solo audio verranno convertiti nel formato preferito. Questo si applica solo durante il download di formati audio.",
|
||||
"audio_format_best": "Migliore (Nessuna conversione)",
|
||||
"audio_format_aac": "AAC (Buono per l'editing)",
|
||||
"audio_format_mp3": "MP3 (Universale)",
|
||||
"audio_format_flac": "FLAC (Senza perdita)",
|
||||
"audio_format_wav": "WAV (Non compresso)",
|
||||
"audio_format_opus": "Opus (Efficiente)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Aperto)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Inserisci URL video YouTube o playlist",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "有効にすると、マージされた動画は優先形式に変換されます。無効にすると、yt-dlpが自動的に決定します。",
|
||||
"format_mp4": "MP4(最も互換性が高い)",
|
||||
"format_webm": "WebM(モダン、オープン)",
|
||||
"format_mkv": "MKV(機能豊富)"
|
||||
"format_mkv": "MKV(機能豊富)",
|
||||
"audio_format_settings": "オーディオ形式設定",
|
||||
"force_audio_format": "オーディオのみのダウンロードにオーディオ形式を強制",
|
||||
"preferred_audio_format": "優先オーディオ形式:",
|
||||
"force_audio_format_help": "有効にすると、オーディオのみのダウンロードが優先形式に変換されます。これはオーディオ形式をダウンロードする場合にのみ適用されます。",
|
||||
"audio_format_best": "最高(変換なし)",
|
||||
"audio_format_aac": "AAC(編集に適している)",
|
||||
"audio_format_mp3": "MP3(汎用)",
|
||||
"audio_format_flac": "FLAC(ロスレス)",
|
||||
"audio_format_wav": "WAV(非圧縮)",
|
||||
"audio_format_opus": "Opus(効率的)",
|
||||
"audio_format_m4a": "M4A(Apple)",
|
||||
"audio_format_vorbis": "Vorbis(オープン)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "YouTubeの動画URLまたはプレイリストURLを入力",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Po włączeniu połączone filmy zostaną przekonwertowane na wybrany format. Wyłącz, aby pozwolić yt-dlp zdecydować automatycznie.",
|
||||
"format_mp4": "MP4 (Najbardziej kompatybilny)",
|
||||
"format_webm": "WebM (Nowoczesny, otwarty)",
|
||||
"format_mkv": "MKV (Bogaty w funkcje)"
|
||||
"format_mkv": "MKV (Bogaty w funkcje)",
|
||||
"audio_format_settings": "Ustawienia formatu audio",
|
||||
"force_audio_format": "Wymuś format audio dla pobierania tylko audio",
|
||||
"preferred_audio_format": "Preferowany format audio:",
|
||||
"force_audio_format_help": "Gdy włączone, pobieranie tylko audio zostanie przekonwertowane na preferowany format. Dotyczy to tylko pobierania formatów audio.",
|
||||
"audio_format_best": "Najlepsze (Bez konwersji)",
|
||||
"audio_format_aac": "AAC (Dobre do edycji)",
|
||||
"audio_format_mp3": "MP3 (Uniwersalny)",
|
||||
"audio_format_flac": "FLAC (Bezstratny)",
|
||||
"audio_format_wav": "WAV (Nieskompresowany)",
|
||||
"audio_format_opus": "Opus (Wydajny)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Otwarty)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Wprowadź URL wideo YouTube lub playlisty",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Quando ativado, os vídeos mesclados serão convertidos para o seu formato preferido. Desative para deixar o yt-dlp decidir automaticamente.",
|
||||
"format_mp4": "MP4 (Mais compatível)",
|
||||
"format_webm": "WebM (Moderno, aberto)",
|
||||
"format_mkv": "MKV (Rico em recursos)"
|
||||
"format_mkv": "MKV (Rico em recursos)",
|
||||
"audio_format_settings": "Configurações de formato de áudio",
|
||||
"force_audio_format": "Forçar formato de áudio para downloads somente de áudio",
|
||||
"preferred_audio_format": "Formato de áudio preferido:",
|
||||
"force_audio_format_help": "Quando ativado, downloads somente de áudio serão convertidos para seu formato preferido. Isso se aplica apenas ao baixar formatos de áudio.",
|
||||
"audio_format_best": "Melhor (Sem conversão)",
|
||||
"audio_format_aac": "AAC (Bom para edição)",
|
||||
"audio_format_mp3": "MP3 (Universal)",
|
||||
"audio_format_flac": "FLAC (Sem perdas)",
|
||||
"audio_format_wav": "WAV (Não comprimido)",
|
||||
"audio_format_opus": "Opus (Eficiente)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Aberto)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Digite a URL do vídeo ou playlist do YouTube",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Когда включено, объединённые видео будут конвертированы в ваш предпочтительный формат. Отключите, чтобы yt-dlp решал автоматически.",
|
||||
"format_mp4": "MP4 (Наиболее совместимый)",
|
||||
"format_webm": "WebM (Современный, открытый)",
|
||||
"format_mkv": "MKV (Многофункциональный)"
|
||||
"format_mkv": "MKV (Многофункциональный)",
|
||||
"audio_format_settings": "Настройки формата аудио",
|
||||
"force_audio_format": "Принудительный формат аудио для загрузки только аудио",
|
||||
"preferred_audio_format": "Предпочтительный формат аудио:",
|
||||
"force_audio_format_help": "При включении загрузки только аудио будут конвертированы в ваш предпочтительный формат. Это применяется только при загрузке аудио форматов.",
|
||||
"audio_format_best": "Лучшее (Без конвертации)",
|
||||
"audio_format_aac": "AAC (Хорошо для редактирования)",
|
||||
"audio_format_mp3": "MP3 (Универсальный)",
|
||||
"audio_format_flac": "FLAC (Без потерь)",
|
||||
"audio_format_wav": "WAV (Несжатый)",
|
||||
"audio_format_opus": "Opus (Эффективный)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Открытый)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "Введите URL видео или плейлиста YouTube",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "Etkinleştirildiğinde, birleştirilen videolar tercih ettiğiniz formata dönüştürülür. yt-dlp'nin otomatik karar vermesini sağlamak için devre dışı bırakın.",
|
||||
"format_mp4": "MP4 (En uyumlu)",
|
||||
"format_webm": "WebM (Modern, açık)",
|
||||
"format_mkv": "MKV (Özellik açısından zengin)"
|
||||
"format_mkv": "MKV (Özellik açısından zengin)",
|
||||
"audio_format_settings": "Ses Formatı Ayarları",
|
||||
"force_audio_format": "Yalnızca ses indirmeleri için ses formatını zorla",
|
||||
"preferred_audio_format": "Tercih edilen ses formatı:",
|
||||
"force_audio_format_help": "Etkinleştirildiğinde, yalnızca ses indirmeleri tercih ettiğiniz formata dönüştürülecektir. Bu yalnızca ses formatları indirilirken geçerlidir.",
|
||||
"audio_format_best": "En iyi (Dönüştürme yok)",
|
||||
"audio_format_aac": "AAC (Düzenleme için iyi)",
|
||||
"audio_format_mp3": "MP3 (Evrensel)",
|
||||
"audio_format_flac": "FLAC (Kayıpsız)",
|
||||
"audio_format_wav": "WAV (Sıkıştırılmamış)",
|
||||
"audio_format_opus": "Opus (Verimli)",
|
||||
"audio_format_m4a": "M4A (Apple)",
|
||||
"audio_format_vorbis": "Vorbis (Açık)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "YouTube video veya oynatma listesi URL'sini girin",
|
||||
|
||||
+13
-1
@@ -293,7 +293,19 @@
|
||||
"force_format_help": "启用后,合并的视频将转换为您的首选格式。禁用以让 yt-dlp 自动决定。",
|
||||
"format_mp4": "MP4(最兼容)",
|
||||
"format_webm": "WebM(现代、开放)",
|
||||
"format_mkv": "MKV(功能丰富)"
|
||||
"format_mkv": "MKV(功能丰富)",
|
||||
"audio_format_settings": "音频格式设置",
|
||||
"force_audio_format": "强制仅音频下载的音频格式",
|
||||
"preferred_audio_format": "首选音频格式:",
|
||||
"force_audio_format_help": "启用后,仅音频下载将转换为您的首选格式。这仅在下载音频格式时适用。",
|
||||
"audio_format_best": "最佳(不转换)",
|
||||
"audio_format_aac": "AAC(适合编辑)",
|
||||
"audio_format_mp3": "MP3(通用)",
|
||||
"audio_format_flac": "FLAC(无损)",
|
||||
"audio_format_wav": "WAV(未压缩)",
|
||||
"audio_format_opus": "Opus(高效)",
|
||||
"audio_format_m4a": "M4A(Apple)",
|
||||
"audio_format_vorbis": "Vorbis(开放)"
|
||||
},
|
||||
"main_ui": {
|
||||
"url_placeholder": "输入 YouTube 视频或播放列表网址",
|
||||
|
||||
@@ -61,6 +61,8 @@ class DownloadThread(QThread):
|
||||
geo_proxy_url=None,
|
||||
force_output_format=False,
|
||||
preferred_output_format="mp4",
|
||||
force_audio_format=False,
|
||||
preferred_audio_format="best",
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.url = url
|
||||
@@ -86,6 +88,8 @@ class DownloadThread(QThread):
|
||||
self.geo_proxy_url = geo_proxy_url
|
||||
self.force_output_format = force_output_format
|
||||
self.preferred_output_format = preferred_output_format
|
||||
self.force_audio_format = force_audio_format
|
||||
self.preferred_audio_format = preferred_audio_format
|
||||
self.paused: bool = False
|
||||
self.cancelled: bool = False
|
||||
self.process: Optional[subprocess.Popen] = None
|
||||
@@ -184,7 +188,7 @@ class DownloadThread(QThread):
|
||||
res_value: str = self.resolution if self.resolution else "720" # Default to 720p if no resolution specified
|
||||
cmd.extend(["-S", f"res:{res_value}"])
|
||||
|
||||
# Force output format if enabled and merging is needed
|
||||
# Force output format if enabled and merging is needed (for video)
|
||||
if self.force_output_format and not self.is_audio_only:
|
||||
if self.format_has_audio:
|
||||
# Progressive format (video with audio) - use remux to convert container
|
||||
@@ -195,6 +199,15 @@ class DownloadThread(QThread):
|
||||
cmd.extend(["--merge-output-format", self.preferred_output_format])
|
||||
logger.debug(f"Using --merge-output-format to force merged format to: {self.preferred_output_format}")
|
||||
|
||||
# Force audio format conversion for audio-only downloads
|
||||
if self.is_audio_only and self.force_audio_format:
|
||||
cmd.append("--extract-audio")
|
||||
if self.preferred_audio_format and self.preferred_audio_format != "best":
|
||||
cmd.extend(["--audio-format", self.preferred_audio_format])
|
||||
logger.debug(f"Using --extract-audio with --audio-format {self.preferred_audio_format} for audio-only download")
|
||||
else:
|
||||
logger.debug("Using --extract-audio with best quality (no conversion) for audio-only download")
|
||||
|
||||
# Output template with resolution in filename
|
||||
# Use string concatenation instead of Path.joinpath to avoid Path object issues
|
||||
base_path: str = self.path.as_posix()
|
||||
|
||||
@@ -234,6 +234,52 @@ class DownloadSettingsDialog(QDialog):
|
||||
output_format_group_box.setLayout(output_format_layout)
|
||||
layout.addWidget(output_format_group_box)
|
||||
|
||||
# --- Audio Format Settings Section (for audio-only downloads) ---
|
||||
audio_format_group_box = QGroupBox(_("settings.audio_format_settings"))
|
||||
audio_format_layout = QVBoxLayout()
|
||||
|
||||
# Load current audio format settings from ConfigManager
|
||||
self.force_audio_format_enabled = ConfigManager.get("force_audio_format") or False
|
||||
self.preferred_audio_format_value = ConfigManager.get("preferred_audio_format") or "best"
|
||||
|
||||
# Enable/Disable force audio format checkbox
|
||||
self.force_audio_format_checkbox = QCheckBox(_("settings.force_audio_format"))
|
||||
self.force_audio_format_checkbox.setChecked(self.force_audio_format_enabled)
|
||||
audio_format_layout.addWidget(self.force_audio_format_checkbox)
|
||||
|
||||
# Audio format selection layout
|
||||
audio_format_select_layout = QHBoxLayout()
|
||||
audio_format_label = QLabel(_("settings.preferred_audio_format"))
|
||||
audio_format_label.setStyleSheet("color: #ffffff; margin-top: 5px;")
|
||||
audio_format_select_layout.addWidget(audio_format_label)
|
||||
|
||||
self.audio_format_combo = QComboBox()
|
||||
self.audio_format_combo.addItems([
|
||||
_("settings.audio_format_best"),
|
||||
_("settings.audio_format_aac"),
|
||||
_("settings.audio_format_mp3"),
|
||||
_("settings.audio_format_flac"),
|
||||
_("settings.audio_format_wav"),
|
||||
_("settings.audio_format_opus"),
|
||||
_("settings.audio_format_m4a"),
|
||||
_("settings.audio_format_vorbis")
|
||||
])
|
||||
# Set current selection based on saved format
|
||||
audio_format_index_map = {"best": 0, "aac": 1, "mp3": 2, "flac": 3, "wav": 4, "opus": 5, "m4a": 6, "vorbis": 7}
|
||||
self.audio_format_combo.setCurrentIndex(audio_format_index_map.get(self.preferred_audio_format_value, 0))
|
||||
audio_format_select_layout.addWidget(self.audio_format_combo)
|
||||
audio_format_select_layout.addStretch()
|
||||
audio_format_layout.addLayout(audio_format_select_layout)
|
||||
|
||||
# Help text for audio format
|
||||
audio_help_label = QLabel(_("settings.force_audio_format_help"))
|
||||
audio_help_label.setWordWrap(True)
|
||||
audio_help_label.setStyleSheet("color: #cccccc; margin: 5px; font-size: 10px;")
|
||||
audio_format_layout.addWidget(audio_help_label)
|
||||
|
||||
audio_format_group_box.setLayout(audio_format_layout)
|
||||
layout.addWidget(audio_format_group_box)
|
||||
|
||||
# Dialog buttons (OK/Cancel)
|
||||
button_box = QDialogButtonBox()
|
||||
ok_button = button_box.addButton(_("buttons.ok"), QDialogButtonBox.ButtonRole.AcceptRole)
|
||||
@@ -277,6 +323,15 @@ class DownloadSettingsDialog(QDialog):
|
||||
format_map = {0: "mp4", 1: "webm", 2: "mkv"}
|
||||
return format_map.get(self.format_combo.currentIndex(), "mp4")
|
||||
|
||||
def get_force_audio_format_enabled(self) -> bool:
|
||||
"""Returns whether force audio format is enabled."""
|
||||
return self.force_audio_format_checkbox.isChecked()
|
||||
|
||||
def get_preferred_audio_format(self) -> str:
|
||||
"""Returns the selected preferred audio format (lowercase)."""
|
||||
audio_format_map = {0: "best", 1: "aac", 2: "mp3", 3: "flac", 4: "wav", 5: "opus", 6: "m4a", 7: "vorbis"}
|
||||
return audio_format_map.get(self.audio_format_combo.currentIndex(), "best")
|
||||
|
||||
def _create_styled_message_box(self, icon, title, text) -> QMessageBox:
|
||||
"""Create a styled QMessageBox that matches the app theme."""
|
||||
msg_box = QMessageBox(self)
|
||||
@@ -321,6 +376,12 @@ class DownloadSettingsDialog(QDialog):
|
||||
ConfigManager.set("force_output_format", force_format)
|
||||
ConfigManager.set("preferred_output_format", preferred_format)
|
||||
|
||||
# Save audio format settings
|
||||
force_audio_format = self.get_force_audio_format_enabled()
|
||||
preferred_audio_format = self.get_preferred_audio_format()
|
||||
ConfigManager.set("force_audio_format", force_audio_format)
|
||||
ConfigManager.set("preferred_audio_format", preferred_audio_format)
|
||||
|
||||
QMessageBox.information(
|
||||
self,
|
||||
_("settings.settings_saved_title"),
|
||||
|
||||
@@ -125,6 +125,8 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
|
||||
# Initialize output format settings
|
||||
self.force_output_format = ConfigManager.get("force_output_format") or False
|
||||
self.preferred_output_format = ConfigManager.get("preferred_output_format") or "mp4"
|
||||
self.force_audio_format = ConfigManager.get("force_audio_format") or False
|
||||
self.preferred_audio_format = ConfigManager.get("preferred_audio_format") or "best"
|
||||
# Track if video analysis is completed
|
||||
self.analysis_completed = False
|
||||
|
||||
@@ -898,6 +900,8 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin): # Inherit from
|
||||
geo_proxy_url=self.geo_proxy_url, # Pass the geo-verification proxy URL
|
||||
force_output_format=self.force_output_format, # Pass force output format setting
|
||||
preferred_output_format=self.preferred_output_format, # Pass preferred format
|
||||
force_audio_format=self.force_audio_format, # Pass force audio format setting
|
||||
preferred_audio_format=self.preferred_audio_format, # Pass preferred audio format
|
||||
)
|
||||
|
||||
# Connect signals
|
||||
|
||||
@@ -84,6 +84,8 @@ class ConfigManager:
|
||||
"ytdlp_channel": "stable",
|
||||
"force_output_format": False,
|
||||
"preferred_output_format": "mp4",
|
||||
"force_audio_format": False,
|
||||
"preferred_audio_format": "best",
|
||||
"cached_versions": {
|
||||
"ytdlp": {"version": None, "path": None, "last_check": 0, "path_mtime": 0},
|
||||
"ffmpeg": {"version": None, "path": None, "last_check": 0, "path_mtime": 0},
|
||||
|
||||
Reference in New Issue
Block a user