summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-08-18 16:10:52 +0300
committerThanos Apollo <[email protected]>2023-08-18 16:10:52 +0300
commit20b610210f3b15f9ec2f5c5e004c52bfcf244e5d (patch)
treec9040d4fb49f96f695205429c3a743f848d61884
parent1a1e2847b481710f22e438e7fadb5c962d7011e7 (diff)
Update yeetube-play-url
If not 'mpv just use 'media-player 'url
-rw-r--r--yeetube.el19
1 files changed, 8 insertions, 11 deletions
diff --git a/yeetube.el b/yeetube.el
index f32727b..829be21 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -156,17 +156,14 @@ Example Usage:
(defun yeetube-play-url (url)
"Open URL using yeetube-player."
- (let ((player (car (split-string yeetube-player))))
- (unless (executable-find player)
- (error (format "%s not found." player))))
- (when (string-prefix-p "http" url)
- (setq yeetube-last-played url)
- (if (string-match "mpv" yeetube-player)
- (shell-command (format "pkill -9 -f mpv"))
- (shell-command (format "pkill -9 -f %s" (shell-quote-argument yeetube-player))))
- (call-process-shell-command
- (format "%s %s" yeetube-player url) nil 0)
- (message "Opening with %s" yeetube-player)))
+ (let ((media-player (executable-find (symbol-name yeetube-player))))
+ (unless media-player
+ (error (format "%s not found." media-player)))
+ (when (string-prefix-p "http" url)
+ (setq yeetube-last-played url)
+ (if (eq yeetube-player 'mpv)
+ (yeetube--mpv-play url)
+ (call-process-shell-command (format "%s %s" media-player url))))))
(defun yeetube-play ()
"Open the url at point in an `'org-mode buffer using ='yeetube-player'."