diff options
author | Thanos Apollo <[email protected]> | 2023-07-15 17:47:51 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-07-15 17:47:51 +0300 |
commit | 985a2e687431fc89814b931e12c439ad1e866530 (patch) | |
tree | f43e9cc9a56bd5531bb513e55e1fceb8d8faf565 | |
parent | c07eb470a8a1d0fad7647dd35607a361ed75da14 (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.
-rw-r--r-- | yeetube.el | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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) |