summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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