diff options
author | Alex <alexta69@gmail.com> | 2021-12-21 08:50:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 08:50:19 +0200 |
commit | e2ebb8c07606f7a9dea8735e0fc20085f0c558e8 (patch) | |
tree | 8398c5f8bdad8cf6afb70f0e5219fa1dbb30cccc | |
parent | Merge pull request #90 from asuyou/dark-mode (diff) | |
download | metube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.tar.gz metube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.tar.bz2 metube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.zip |
always set mp3 quality (closes #93)
-rw-r--r-- | app/dl_formats.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/app/dl_formats.py b/app/dl_formats.py index 121ce6b..2a5bb5a 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -57,13 +57,11 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict: opts["postprocessors"] = [] if format == "mp3": - extra_args = {} - if quality != "best": - extra_args = {"preferredquality": quality} - - opts["postprocessors"].append( - {"key": "FFmpegExtractAudio", "preferredcodec": "mp3", **extra_args}, - ) + opts["postprocessors"].append({ + "key": "FFmpegExtractAudio", + "preferredcodec": "mp3", + "preferredquality": 0 if quality == "best" else quality}, + }) opts["writethumbnail"] = True opts["postprocessors"].append({"key": "FFmpegMetadata"}) opts["postprocessors"].append({"key": "EmbedThumbnail"}) |