From b9dde5f7941ae244ac13cfd96e0107575b85b48a Mon Sep 17 00:00:00 2001 From: georgekav2 <> Date: Mon, 13 Jun 2022 02:06:40 +0200 Subject: Add M4A GUI support --- ui/src/app/formats.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/src/app/formats.ts b/ui/src/app/formats.ts index a3bf3e8..7668e49 100644 --- a/ui/src/app/formats.ts +++ b/ui/src/app/formats.ts @@ -22,6 +22,15 @@ export const Formats: Format[] = [ { id: 'audio', text: 'Audio Only' }, ], }, + { + id: 'm4a', + text: 'M4A', + qualities: [ + { id: 'best', text: 'Best' }, + { id: '192', text: '192 kbps' }, + { id: '128', text: '128 kbps' }, + ], + }, { id: 'mp4', text: 'MP4', -- cgit From 821451b301e9e64678e03022cd4c53fc744c948f Mon Sep 17 00:00:00 2001 From: georgekav2 <> Date: Mon, 13 Jun 2022 02:07:48 +0200 Subject: Add M4A backend support. --- app/dl_formats.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/dl_formats.py b/app/dl_formats.py index 5936b35..e2f6591 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -23,14 +23,13 @@ def get_format(format: str, quality: str) -> str: # Quality is irrelevant in this case since we skip the download return "bestaudio/best" - if format == "mp3": + if format in ("m4a", "mp3"): # Audio quality needs to be set post-download, set in opts return "bestaudio/best" if format in ("mp4", "any"): if quality == "audio": return "bestaudio/best" - # video {res} {vfmt} + audio {afmt} {res} {vfmt} vfmt, afmt = ("[ext=mp4]", "[ext=m4a]") if format == "mp4" else ("", "") vres = f"[height<={quality}]" if quality != "best" else "" @@ -60,12 +59,13 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict: if "postprocessors" not in opts: opts["postprocessors"] = [] - if format == "mp3": + if format in ("m4a", "mp3"): opts["postprocessors"].append({ "key": "FFmpegExtractAudio", - "preferredcodec": "mp3", + "preferredcodec": format, "preferredquality": 0 if quality == "best" else quality, }) + opts["writethumbnail"] = True opts["postprocessors"].append({"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"}) opts["postprocessors"].append({"key": "FFmpegMetadata"}) -- cgit From 07be2c054f40ee099506d79af242c6a51749a572 Mon Sep 17 00:00:00 2001 From: georgekav <> Date: Mon, 20 Feb 2023 14:35:55 +0100 Subject: Add missing m4a checks for audio file --- app/ytdl.py | 2 +- ui/src/app/app.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ytdl.py b/app/ytdl.py index 0a74b14..3c21e0e 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -234,7 +234,7 @@ class DownloadQueue: if not self.queue.exists(entry['id']): dl = DownloadInfo(entry['id'], entry['title'], entry.get('webpage_url') or entry['url'], quality, format, folder) # Keep consistent with frontend - base_directory = self.config.DOWNLOAD_DIR if (quality != 'audio' and format != 'mp3') else self.config.AUDIO_DOWNLOAD_DIR + base_directory = self.config.DOWNLOAD_DIR if (quality != 'audio' and format not in ("m4a", "mp3")) else self.config.AUDIO_DOWNLOAD_DIR if folder: if not self.config.CUSTOM_DIRS: return {'status': 'error', 'msg': f'A folder for the download was specified but CUSTOM_DIRS is not true in the configuration.'} diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 7038b68..5cbb84c 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -94,7 +94,7 @@ export class AppComponent implements AfterViewInit { } isAudioType() { - return this.quality == 'audio' || this.format == 'mp3'; + return this.quality == 'audio' || this.format == 'mp3' || this.format == 'm4a'; } getMatchingCustomDir() : Observable { -- cgit