~heckyel/livie

bd11a3cc9a83e7b09294c4fa2f3e51659b00ca5a — Jesús 3 years ago 760deaf
Add support to quality selection
1 files changed, 10 insertions(+), 6 deletions(-)

M livie.el
M livie.el => livie.el +10 -6
@@ 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)