aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-07-15 17:47:51 +0300
committerThanos Apollo <[email protected]>2023-07-15 17:47:51 +0300
commit985a2e687431fc89814b931e12c439ad1e866530 (patch)
treef43e9cc9a56bd5531bb513e55e1fceb8d8faf565 /yeetube.el
parentc07eb470a8a1d0fad7647dd35607a361ed75da14 (diff)
yeetube-play: kill mpv
There was an issue that using different flags wouldn't kill current playing song. If user is using the mpv which is the default, this should not be an issue any more.
Diffstat (limited to 'yeetube.el')
-rw-r--r--yeetube.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/yeetube.el b/yeetube.el
index 6b56c2e..1744d15 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -110,23 +110,23 @@ It's recommended you keep it as the default value."
(define-key yeetube-mode-map (kbd "v") 'yeetube-toggle-video-mpv)
yeetube-mode-map))
+
(defvar yeetube--currently-playing nil)
(defun yeetube-check-if-youtube (url)
- "Check if URL contain youtube."
+ "Check if it's a youtube URL."
(if (string-match-p "youtube" url)
t
nil))
-;; ISSUE?: if user plays with --no-video flag
-;; openning a new url without --no-video flag
-;; will not kill previous session.
(defun yeetube-play ()
"Open the url at point in an `'org-mode buffer using 'yeetube-player'."
(interactive)
(let ((url (org-element-property
:raw-link (org-element-context))))
- (shell-command (format "pkill -9 -f %s" (shell-quote-argument yeetube-player)))
+ (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))))
(when (string-prefix-p "http" url)
(call-process-shell-command
(format "%s %s" yeetube-player url) nil 0)