From 4af11977682dd18f07484de299f0ab11b07032e0 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Fri, 16 Jun 2006 23:38:00 +0000 Subject: emms-player-mpd: Make the playable-p function return nil if we cannot start a connection to mpd. darcs-hash:20060616233847-1bfb2-6b95e1e17b907cc46204c74b7ea9a59963e86dde.gz --- emms-player-mpd.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/emms-player-mpd.el b/emms-player-mpd.el index cbcfe9d..0ab8b8b 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -803,7 +803,11 @@ 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)))) + (emms-track-name track)) + (condition-case nil + (progn (emms-player-mpd-ensure-process) + t) + (error nil)))) (defun emms-player-mpd-play (&optional id) "Play whatever is in the current MusicPD playlist. @@ -1087,6 +1091,8 @@ The track should be an alist as per `emms-player-mpd-get-alist'." This is useful to do when you have recently acquired new music." (interactive (list (read-string "Directory: "))) + (unless (string= dir "") + (setq dir (emms-player-mpd-get-mpd-filename dir))) (if emms-cache-set-function (progn (message "Dumping MusicPD data to cache...") -- cgit v1.2.3