From bd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Mon, 18 Jan 2021 18:02:34 -0500 Subject: Add support to quality selection --- livie.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/livie.el b/livie.el index 180ad17..b336ec9 100644 --- a/livie.el +++ b/livie.el @@ -457,12 +457,16 @@ If ARG is given, make a new search." (interactive) (if (equal (livie--get-entry-type (livie-get-current-video)) 'video) (let* ((video (livie-get-current-video)) - (id (livie-video-id video))) - (start-process "livie-mpv" nil - "mpv" - (concat "https://www.youtube.com/watch?v=" id - " --ytdl-format='bestvideo[vcodec!=av01.0.05M.08]+bestaudio/best[vcodec!=av01.0.05M.08]'")) - (message "Starting streaming...")) + (id (livie-video-id video)) + (quality-arg "") + (quality-val (completing-read "Max height resolution (0 for unlimited): " + '("0" "240" "360" "480" "720" "1080") + nil nil))) + (setq quality-val (string-to-number quality-val)) + (when (< 0 quality-val) + (setq quality-arg (format "--ytdl-format=[height<=?%s]" quality-val))) + (start-process "livie-mpv" nil "mpv" (format "https://www.youtube.com/watch?v=%s" id) quality-arg) + (message "Opening [youtube] %s with height≤%s with mpv..." id quality-val)) (message "It's not a video"))) (defun livie-yank-channel-feed (&optional arg) -- cgit v1.2.3