aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorgeorgekav <>2023-02-19 21:48:18 +0100
committergeorgekav <>2023-03-05 00:34:30 +0100
commiteca44aa950f82d518303e11c112267be2437abd0 (patch)
tree54d1a89584531c482256eddfac043876b783cb86 /app
parentupgraded yt-dlp (diff)
downloadmetube-eca44aa950f82d518303e11c112267be2437abd0.tar.gz
metube-eca44aa950f82d518303e11c112267be2437abd0.tar.bz2
metube-eca44aa950f82d518303e11c112267be2437abd0.zip
Add support for opus and wav
Diffstat (limited to 'app')
-rw-r--r--app/dl_formats.py14
-rw-r--r--app/ytdl.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/app/dl_formats.py b/app/dl_formats.py
index e2f6591..76c1b38 100644
--- a/app/dl_formats.py
+++ b/app/dl_formats.py
@@ -23,7 +23,7 @@ def get_format(format: str, quality: str) -> str:
# Quality is irrelevant in this case since we skip the download
return "bestaudio/best"
- if format in ("m4a", "mp3"):
+ if format in ("m4a", "mp3", "opus", "wav"):
# Audio quality needs to be set post-download, set in opts
return "bestaudio/best"
@@ -59,17 +59,17 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
if "postprocessors" not in opts:
opts["postprocessors"] = []
- if format in ("m4a", "mp3"):
+ if format in ("m4a", "mp3", "opus", "wav"):
opts["postprocessors"].append({
"key": "FFmpegExtractAudio",
"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"})
- opts["postprocessors"].append({"key": "EmbedThumbnail"})
+ if format not in ("wav"):
+ opts["writethumbnail"] = True
+ opts["postprocessors"].append({"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"})
+ opts["postprocessors"].append({"key": "FFmpegMetadata"})
+ opts["postprocessors"].append({"key": "EmbedThumbnail"})
if format == "thumbnail":
opts["skip_download"] = True
diff --git a/app/ytdl.py b/app/ytdl.py
index 3c21e0e..b72f883 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 not in ("m4a", "mp3")) else self.config.AUDIO_DOWNLOAD_DIR
+ base_directory = self.config.DOWNLOAD_DIR if (quality != 'audio' and format not in ("m4a", "mp3", "opus", "wav")) 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.'}
bgstack15