summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-07-03 09:44:53 +0300
committerThanos Apollo <[email protected]>2023-07-03 09:44:53 +0300
commit3011fca72a8080ee380a23eb601f73b83aa90824 (patch)
tree527ffd1752df8d1dd8e60304674ecd52269767f0
parentf270385a5b0576a418a4089864262a52814674b7 (diff)
yeetube-play: Move to call-process-shell-command
Redo this function using call-process-shell-command & kill all previous commands with 'yeetube-player' This way the user can just select video/song to play and get back to whatever he was working on, without generating new buffers that async-shell-command does.
-rw-r--r--yeetube.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/yeetube.el b/yeetube.el
index 50a9d44..46ac97b 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -96,10 +96,14 @@ Example Usage:
"Open the url at point in an `'org-mode buffer using 'yeetube-player'."
(interactive)
(let ((url (org-element-property
- :raw-link (org-element-context))))
+ :raw-link (org-element-context)))
+ (buffer (get-buffer "*Yeetube Player*")))
+ (shell-command (format "pkill -9 -f %s" (shell-quote-argument yeetube-player)))
(when (string-prefix-p "http" url)
- (async-shell-command (format "%s %s" yeetube-player url))
- (message "Opening %s with mpv" url))))
+ (call-process-shell-command
+ (format "%s %s" yeetube-player url) nil 0)
+ (message "Opening %s" url)
+ (switch-to-buffer buffer))))
;; TODO: Check if video_type of videoid is short or video