aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-06-04 19:54:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-06-04 19:54:00 +0000
commit9d10b8d562b427db7720433bc09ccdd6536dfc05 (patch)
treeb17408e3b4cdea3e74cf5060b3dfe9b15e764f27
parent4247641fe4ac444777bca527bbbcda9eff454d27 (diff)
emms-player-mpd: Differentiate between files and URLs when it makes sense to do so.
darcs-hash:20060604195449-1bfb2-5f43698ad0ff4945541f3aaf8244e1590333f39d.gz
-rw-r--r--emms-player-mpd.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el
index 6756bfb..73e4abc 100644
--- a/emms-player-mpd.el
+++ b/emms-player-mpd.el
@@ -446,9 +446,12 @@ The list will be in reverse order."
(tracks nil))
(when songs
(dolist (song-info songs)
- (let (cell)
- (when (setq cell (assoc "file" song-info))
- (let ((track (emms-track 'file (cdr cell))))
+ (let ((file (cdr (assoc "file" song-info))))
+ (when file
+ (let* ((type (if (string-match "\\`http://" file)
+ 'url
+ 'file))
+ (track (emms-track type file)))
(emms-info-mpd track song-info)
(setq tracks (cons track tracks)))))))
(funcall (car closure) (cdr closure) tracks)))
@@ -963,13 +966,18 @@ positive or negative."
(when name
(setq desc name))
(when file
- (let ((track (emms-dictionary '*track*)))
- (emms-track-set track 'type 'file)
+ (let ((track (emms-dictionary '*track*))
+ track-desc)
+ (if (string-match "\\`http://" file)
+ (emms-track-set track 'type 'url)
+ (emms-track-set track 'type 'file))
(emms-track-set track 'name file)
(emms-info-mpd track info)
- (if name
- (setq desc (concat name ": " (emms-track-description track)))
- (setq desc (emms-track-description track))))))
+ (setq track-desc (emms-track-description track))
+ (when (and (stringp track-desc) (not (string= track-desc "")))
+ (setq desc (if desc
+ (concat desc ": " track-desc)
+ track-desc))))))
(if (not desc)
(message "Nothing playing right now")
(setq desc (format emms-show-format desc))