From de9eebfc28e504a92d8ef5057001d183be8f7bbf Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 21 Nov 2023 08:44:06 +0200 Subject: yeetube-mpv: Add yeetube-mpv-check Check if yt-dlp & mpv is installed, produce an error if not. --- yeetube-mpv.el | 9 +++++++-- 1 file 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)) -- cgit v1.2.3