(Emacs/elisp/mpv)-ytdl specific config

This commit is contained in:
2024-08-21 16:34:56 +01:00
parent ecc47d5dfb
commit 057b15a50d

View File

@@ -27,15 +27,9 @@
(autoload #'ansi-color-for-comint-mode-on "ansi-color")
(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"
"General arguments for mpv binary.")
(defun mpv--make-args ()
(concat mpv-args " " mpv-ytdl-args))
(defun mpv-start-process (url)
(message "[mpv]: Starting mpv on `%s'" url)
(with-current-buffer (get-buffer-create "*mpv*")
@@ -43,11 +37,9 @@
(comint-mode))
(set-process-filter (start-process-shell-command
"mpv" "*mpv*"
(concat "mpv " (mpv--make-args) " \"" url "\""))
(concat "mpv " mpv-args " \"" url "\""))
#'comint-output-filter))
(defvar mpv--history nil)
(defun mpv-open-video (&optional arg)
(interactive)
(let ((url (if (stringp arg)
@@ -56,9 +48,5 @@
(mpv-start-process url)
(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)
;;; mpv.el ends here