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

Morgan Smith <[email protected]>
Newsgroups gmane.emacs.emms.user
Message-ID <CH3PR84MB3424666CC9457379DDFF3A29C58EA@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.