Allow org-yt-open
to use emms' or
mpv'
This commit is contained in:
parent
d956948796
commit
295ec8b3bc
26
README.org
26
README.org
@ -2605,14 +2605,24 @@ The listings below implement four groups of =org-link= types:
|
||||
:export #'org-yt-export)
|
||||
|
||||
(defun org-yt-open (path prefix)
|
||||
"Open an \"yt\" link."
|
||||
(let* ((url (format "https:%s" path))
|
||||
(display-buffer-alist
|
||||
`((,shell-command-buffer-name-async . (display-buffer-no-window)))))
|
||||
(if (and prefix (executable-find "mpv"))
|
||||
(browse-url url)
|
||||
(async-shell-command (format "mpv \"%s\"" url))
|
||||
(message "Launched mpv with \"%s\"" url))))
|
||||
"Open PATH with \"emms\", \"mpv\", or `browse-url' (when PREFIX)."
|
||||
(let ((url (format "https:%s" path)))
|
||||
(cond
|
||||
(prefix
|
||||
(browse-url url))
|
||||
((require 'emms nil 'noerror)
|
||||
(emms-add-url url)
|
||||
(with-current-emms-playlist
|
||||
(save-excursion
|
||||
(emms-playlist-last)
|
||||
(emms-playlist-mode-play-current-track))) )
|
||||
((executable-find "mpv")
|
||||
(let ((display-buffer-alist
|
||||
`((,shell-command-buffer-name-async . (display-buffer-no-window)))))
|
||||
(async-shell-command (format "\"%s\" \"%s\"" url)))
|
||||
(message "Launched mpv with \"%s\"" url))
|
||||
(t
|
||||
(user-error "Can't open `%s': install `emms' and/or `mpv'" url)))))
|
||||
|
||||
(defun org-yt-export (path desc backend _)
|
||||
"Export an \"yt\" link."
|
||||
|
Loading…
Reference in New Issue
Block a user