summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-02-09 09:10:45 +0200
committerThanos Apollo <[email protected]>2024-02-09 18:38:45 +0200
commit5db25e807fb6fc67d40bdb3126487d442523e989 (patch)
treef746fe71bd6ca06a19f39dde12967fcddf71f39f
parent9f3d9962279df31659e3d0d6b0bfe232e2edac9a (diff)
Add yeetube-mpv-ytdl-format-video-quality
-rw-r--r--yeetube-mpv.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el
index cd436e6..5b43ae1 100644
--- a/yeetube-mpv.el
+++ b/yeetube-mpv.el
@@ -72,6 +72,10 @@ Accepted values include: 1080, 720, 480, 360, 240, 144")
(start-process-shell-command
"yeetube" nil command))))
+(defun yeetube-mpv-ytdl-format-video-quality (resolution)
+ "Return shell quoted argument for ytdlp with RESOLUTION."
+ (shell-quote-argument (format "bestvideo[height<=?%s]+bestaudio/best" resolution)))
+
(defun yeetube-mpv-play (input)
"Start yeetube process to play INPUT using mpv.
@@ -80,7 +84,9 @@ to play local files."
(yeetube-mpv-process
(concat (when yeetube-mpv-enable-torsocks
(concat yeetube-mpv-torsocks " "))
- yeetube-mpv-path " "
+ yeetube-mpv-path " --ytdl-format="
+ (yeetube-mpv-ytdl-format-video-quality yeetube-mpv-video-quality)
+ " "
(shell-quote-argument input)
(when yeetube-mpv-disable-video " --no-video")))
(message (if yeetube-mpv-enable-torsocks