diff options
author | Thanos Apollo <[email protected]> | 2023-11-21 08:44:06 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-11-21 08:44:06 +0200 |
commit | de9eebfc28e504a92d8ef5057001d183be8f7bbf (patch) | |
tree | 197b20cf35ce0623e3b1545cb508f859bca9acd9 | |
parent | 41940fc90e817fbf166f1ffaee16c469d9b8db86 (diff) |
yeetube-mpv: Add yeetube-mpv-check
Check if yt-dlp & mpv is installed, produce an error if not.
-rw-r--r-- | yeetube-mpv.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el index 45cd6f8..24a10a1 100644 --- a/yeetube-mpv.el +++ b/yeetube-mpv.el @@ -34,10 +34,15 @@ (defvar yeetube-mpv-path (executable-find "mpv") "Path for mpv executable.") +(defun yeetube-mpv-check () + "Check if mpv and yt-dlp is installed." + (pcase (and (executable-find "mpv") + (executable-find "yt-dlp")) + (`nil (error "Unable to play video. Please install `yt-dlp' and `mpv'")))) + (defun yeetube-mpv-process (command) "Start yeetube process for shell COMMAND." - (unless yeetube-mpv-path - (error "Mpv not found. Install mpv or change the value of yeetube-player")) + (yeetube-mpv-check) (let ((yeetube-mpv-process "yeetube")) (dolist (process (process-list)) (when (string-match yeetube-mpv-process (process-name process)) |