emms-help
[Top][All Lists]
Advanced

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

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


From: Ian Eure
Subject: Re: [PATCH] * emms-player-mpd.el: Only play using MPD if the file is in the right directory
Date: Tue, 12 Dec 2023 14:00:14 -0800
User-agent: K-9 Mail for Android

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 <Morgan.J.Smith@outlook.com> 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.
Thanks,

  — Ian

reply via email to

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