aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex <alexta69@gmail.com>2021-12-21 08:50:19 +0200
committerGitHub <noreply@github.com>2021-12-21 08:50:19 +0200
commite2ebb8c07606f7a9dea8735e0fc20085f0c558e8 (patch)
tree8398c5f8bdad8cf6afb70f0e5219fa1dbb30cccc /app
parentMerge pull request #90 from asuyou/dark-mode (diff)
downloadmetube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.tar.gz
metube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.tar.bz2
metube-e2ebb8c07606f7a9dea8735e0fc20085f0c558e8.zip
always set mp3 quality (closes #93)
Diffstat (limited to 'app')
-rw-r--r--app/dl_formats.py12
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"})
bgstack15