(Emacs/elisp/mpv)-ytdl specific config
This commit is contained in:
@@ -27,15 +27,9 @@
|
|||||||
(autoload #'ansi-color-for-comint-mode-on "ansi-color")
|
(autoload #'ansi-color-for-comint-mode-on "ansi-color")
|
||||||
(autoload #'comint-output-filter "comint")
|
(autoload #'comint-output-filter "comint")
|
||||||
|
|
||||||
(defvar mpv-ytdl-args "--ytdl-format=\"bestvideo[height<=1080][fps<=60]+bestaudio/best[height<=1080]\""
|
|
||||||
"Arguments for ytdl in mpv format.")
|
|
||||||
|
|
||||||
(defvar mpv-args "-v --profile=fast --hwdec=auto-copy"
|
(defvar mpv-args "-v --profile=fast --hwdec=auto-copy"
|
||||||
"General arguments for mpv binary.")
|
"General arguments for mpv binary.")
|
||||||
|
|
||||||
(defun mpv--make-args ()
|
|
||||||
(concat mpv-args " " mpv-ytdl-args))
|
|
||||||
|
|
||||||
(defun mpv-start-process (url)
|
(defun mpv-start-process (url)
|
||||||
(message "[mpv]: Starting mpv on `%s'" url)
|
(message "[mpv]: Starting mpv on `%s'" url)
|
||||||
(with-current-buffer (get-buffer-create "*mpv*")
|
(with-current-buffer (get-buffer-create "*mpv*")
|
||||||
@@ -43,11 +37,9 @@
|
|||||||
(comint-mode))
|
(comint-mode))
|
||||||
(set-process-filter (start-process-shell-command
|
(set-process-filter (start-process-shell-command
|
||||||
"mpv" "*mpv*"
|
"mpv" "*mpv*"
|
||||||
(concat "mpv " (mpv--make-args) " \"" url "\""))
|
(concat "mpv " mpv-args " \"" url "\""))
|
||||||
#'comint-output-filter))
|
#'comint-output-filter))
|
||||||
|
|
||||||
(defvar mpv--history nil)
|
|
||||||
|
|
||||||
(defun mpv-open-video (&optional arg)
|
(defun mpv-open-video (&optional arg)
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((url (if (stringp arg)
|
(let ((url (if (stringp arg)
|
||||||
@@ -56,9 +48,5 @@
|
|||||||
(mpv-start-process url)
|
(mpv-start-process url)
|
||||||
(switch-to-buffer "*mpv*")))
|
(switch-to-buffer "*mpv*")))
|
||||||
|
|
||||||
(let ((url (completing-read "Enter URL: " nil nil t (ffap-guesser) mpv--history)))
|
|
||||||
(mpv-start-process url)
|
|
||||||
(switch-to-buffer "*mpv*")))
|
|
||||||
|
|
||||||
(provide 'mpv)
|
(provide 'mpv)
|
||||||
;;; mpv.el ends here
|
;;; mpv.el ends here
|
||||||
|
|||||||
Reference in New Issue
Block a user