Add support to quality selection

This commit is contained in:
Jesús 2021-01-18 18:02:34 -05:00
parent 760deafd20
commit bd11a3cc9a
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -457,12 +457,16 @@ If ARG is given, make a new search."
(interactive) (interactive)
(if (equal (livie--get-entry-type (livie-get-current-video)) 'video) (if (equal (livie--get-entry-type (livie-get-current-video)) 'video)
(let* ((video (livie-get-current-video)) (let* ((video (livie-get-current-video))
(id (livie-video-id video))) (id (livie-video-id video))
(start-process "livie-mpv" nil (quality-arg "")
"mpv" (quality-val (completing-read "Max height resolution (0 for unlimited): "
(concat "https://www.youtube.com/watch?v=" id '("0" "240" "360" "480" "720" "1080")
" --ytdl-format='bestvideo[vcodec!=av01.0.05M.08]+bestaudio/best[vcodec!=av01.0.05M.08]'")) nil nil)))
(message "Starting streaming...")) (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"))) (message "It's not a video")))
(defun livie-yank-channel-feed (&optional arg) (defun livie-yank-channel-feed (&optional arg)