diff options
author | asuyou <asuyou@users.noreply.github.com> | 2021-10-25 17:15:09 +0100 |
---|---|---|
committer | asuyou <asuyou@users.noreply.github.com> | 2021-10-25 17:15:09 +0100 |
commit | b3a589f1a9d4f84e180623cb32cb826579f52553 (patch) | |
tree | 4acc6828ec2f0c90be469c641430bc670bdf307a | |
parent | upgraded yt-dlp (diff) | |
download | metube-b3a589f1a9d4f84e180623cb32cb826579f52553.tar.gz metube-b3a589f1a9d4f84e180623cb32cb826579f52553.tar.bz2 metube-b3a589f1a9d4f84e180623cb32cb826579f52553.zip |
Added simple MP3 support
-rw-r--r-- | app/ytdl.py | 8 | ||||
-rw-r--r-- | ui/src/app/app.component.ts | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/app/ytdl.py b/app/ytdl.py index f9084e3..0400877 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -39,6 +39,14 @@ class Download: vfmt, afmt = '', ''
if format == 'mp4':
vfmt, afmt = '[ext=mp4]', '[ext=m4a]'
+ elif format == 'mp3':
+ afmt = '/best'
+ ytdl_opts["writethumbnail"] = True
+ ytdl_opts["postprocessors"] = [
+ {"key": "FFmpegExtractAudio", "preferredcodec": "mp3"},
+ {"key": "EmbedThumbnail"},
+ ]
+
if quality == 'best':
self.format = f'bestvideo{vfmt}+bestaudio{afmt}/best{vfmt}'
elif quality in ('1440p', '1080p', '720p', '480p'):
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 55f7e6e..a86bbe1 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -24,7 +24,8 @@ export class AppComponent implements AfterViewInit { quality: string; formats: Array<Object> = [ {id: "any", text: "Any"}, - {id: "mp4", text: "MP4"} + {id: "mp4", text: "MP4"}, + {id: "mp3", text: "MP3"} ]; format: string; addInProgress = false; |