Define default stream

This commit is contained in:
Jesús 2021-01-22 17:10:40 -05:00
parent 8ad25fded8
commit 2e031a449a
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -458,13 +458,18 @@ If ARG is given, make a new search."
(if (equal (livie--get-entry-type (livie-get-current-video)) 'video)
(let* ((video (livie-get-current-video))
(id (livie-video-id video))
(quality-arg "")
(quality-val (completing-read "Max height resolution (0 for unlimited): "
'("0" "240" "360" "480" "720" "1080")
(quality-val (completing-read "Max height resolution for default is 480 (0 for unlimited): "
'("default" "0" "240" "360" "480" "720" "1080")
nil nil)))
(setq quality-val (string-to-number quality-val))
(when (< 0 quality-val)
(if (not (equal quality-val "default"))
(setq quality-val (string-to-number quality-val))
(setq quality-val 480))
(if (equal quality-val 0)
(setq quality-arg "")
(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")))