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

Ian Eure <[email protected]>
Newsgroups gmane.emacs.emms.user
Message-ID <[email protected]>
Note that MPD doesn't necessarily run on the same computer or or as the same user as EMMS, so the view and accessibility can differ drastically between client and server.

I think this probably shouldn't be merged; at minimum, you'd want the check conditional on connecting to a local MPD — though this would still break cases where it runs as a different user.  For example, Debian defaults to a systemwide mpd, which runs as the mpd user.

On December 12, 2023 11:07:11 AM PST, Morgan Smith <[email protected]> wrote:
>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
>
>

Thanks,

  — Ian
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.