~heckyel/livie

2e031a449a789fe086245620703b1ae46388e2f7 — Jesús 3 years ago 8ad25fd
Define default stream
1 files changed, 10 insertions(+), 5 deletions(-)

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