summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yeetube.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/yeetube.el b/yeetube.el
index 829be21..9da745f 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -216,6 +216,21 @@ Example Usage:
(defun yeetube-disable-video-mpv ()
"Toggle video on/off for mpv player."
+(defun yeetube--mpv-play (url)
+ "Use mpv to play URL."
+ (let ((mpv (executable-find "mpv"))
+ (socket (concat (temporary-file-directory) "yeetube-socket"))
+ (process-name "yeetube"))
+ (dolist (process (process-list))
+ (when (string-match process-name (process-name process))
+ (kill-process process)))
+ (sit-for 0.1)
+ (unless (get-process process-name)
+ (start-process-shell-command
+ "yeetube" nil
+ (if yeetube-mpv-disable-video
+ (format "%s --no-video --input-ipc-server=%s %s" mpv socket url)
+ (format "%s --input-ipc-server= %s %s" mpv socket url))))))
(interactive)
(let ((socket (concat " --input-ipc-server=" yeetube-mpv-socket))
(no-video " --no-video")