summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-08-18 16:11:52 +0300
committerThanos Apollo <[email protected]>2023-08-18 16:11:52 +0300
commit12420598f4c07a8fceceb2ae5a0e7792f6be0693 (patch)
treef0c8e7e23c4d361fcd1faf4bce7841800c12b9db
parent20b610210f3b15f9ec2f5c5e004c52bfcf244e5d (diff)
Add yeetube--mpv-play
Used to play url and defining a process session
-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")