aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-01-18 18:02:34 -0500
committerJesús <heckyel@hyperbola.info>2021-01-18 18:02:34 -0500
commitbd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a (patch)
tree68201bee15a9e4011d8502134650f51e6a276a0a
parent760deafd201abad58b04c6a8d7fa478df72b8eda (diff)
downloadlivie-bd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a.tar.lz
livie-bd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a.tar.xz
livie-bd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a.zip
Add support to quality selection
-rw-r--r--livie.el16
1 files 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)