emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] * emms-player-mpd.el: Only play using MPD if the file is in the


From: Morgan Smith
Subject: [PATCH] * emms-player-mpd.el: Only play using MPD if the file is in the right directory
Date: Tue, 12 Dec 2023 14:07:11 -0500

Check to see if the file is in `emms-player-mpd-music-directory'.
---
 emms-player-mpd.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/emms-player-mpd.el b/emms-player-mpd.el
index d1d6257..2666744 100644
--- a/emms-player-mpd.el
+++ b/emms-player-mpd.el
@@ -892,11 +892,14 @@ Execute CALLBACK with CLOSURE as its first argument when 
done."
   "Return non-nil when we can play this track."
   (and (memq (emms-track-type track) '(file url playlist streamlist))
        (string-match (emms-player-get emms-player-mpd 'regex)
-                    (emms-track-name track))
-       (condition-case nil
-          (progn (emms-player-mpd-ensure-process)
-                 t)
-        (error nil))))
+                     (emms-track-name track))
+       (if emms-player-mpd-music-directory
+           (file-in-directory-p (emms-track-get track 'name)
+                                emms-player-mpd-music-directory)
+         t)
+       (ignore-errors
+         (emms-player-mpd-ensure-process)
+         t)))
 
 (defun emms-player-mpd-play (&optional id)
   "Play whatever is in the current MusicPD playlist.
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]