diff options
author | Michael Olson <mwolson@gnu.org> | 2007-04-09 05:19:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2007-04-09 05:19:00 +0000 |
commit | 5495e8c0655a1e5137ceaf0cc8331433cdae54bf (patch) | |
tree | 4bc0054cc203869403169fea9456d86c8cdf9dab /emms-player-mpd.el | |
parent | 8652257258a7306505f24360b54284cca6308d3c (diff) |
emms-player-mpd: Fix erroneous extra message and be more careful about the current buffer
darcs-hash:20070409051913-1bfb2-c965d42ac45f6510003919c6cba7783164028ea3.gz
Diffstat (limited to 'emms-player-mpd.el')
-rw-r--r-- | emms-player-mpd.el | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index d96b031..5e29504 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -717,17 +717,18 @@ If an error occurs, display a relevant message." (when (functionp callback) (funcall callback close))))))) -(defun emms-player-mpd-add-buffer-contents (closure callback) - "Load contents of the current buffer into MusicPD by adding each line. +(defun emms-player-mpd-add-buffer-contents (buffer closure callback) + "Load contents of BUFFER into MusicPD by adding each line. Execute CALLBACK with CLOSURE as its first argument when done. This handles both m3u and pls type playlists." - (goto-char (point-min)) - (let ((format (emms-source-playlist-determine-format))) - (when format - (emms-player-mpd-add-several-files - (emms-source-playlist-files format) - closure callback)))) + (with-current-buffer buffer + (goto-char (point-min)) + (let ((format (emms-source-playlist-determine-format))) + (when format + (emms-player-mpd-add-several-files + (emms-source-playlist-files format) + closure callback))))) (defun emms-player-mpd-add-playlist (playlist closure callback) "Load contents of PLAYLIST into MusicPD by adding each line. @@ -737,7 +738,7 @@ This handles both m3u and pls type playlists." ;; This is useful for playlists of playlists (with-temp-buffer (insert-file-contents playlist) - (emms-player-mpd-add-buffer-contents closure callback))) + (emms-player-mpd-add-buffer-contents (current-buffer) closure callback))) (defun emms-player-mpd-add-streamlist (url closure callback) "Download contents of URL and then add its feeds into MusicPD. @@ -748,8 +749,9 @@ Execute CALLBACK with CLOSURE as its first argument when done." (require 'emms-url) (with-temp-buffer (url-insert-file-contents (emms-escape-url url)) - (emms-http-decode-buffer) - (emms-player-mpd-add-buffer-contents closure callback))) + (emms-http-decode-buffer (current-buffer)) + (emms-player-mpd-add-buffer-contents (current-buffer) + closure callback))) (error (message (concat "You need to install url.el so that" " Emms can retrieve this stream"))))) @@ -999,17 +1001,17 @@ positive or negative." (name (cdr (assoc "name" info))) ; radio feeds sometimes set this (file (cdr (assoc "file" info))) (desc nil)) - (when info - (when name - (setq desc name)) - ;; if we are playing lastfm radio, use its show function instead - (if (and (boundp 'emms-lastfm-radio-stream-url) - (stringp emms-lastfm-radio-stream-url) - (string= emms-lastfm-radio-stream-url file)) - (with-current-buffer buffer - (and (fboundp 'emms-lastfm-np) - (emms-lastfm-np insertp callback))) - ;; otherwise build and show the description + ;; if we are playing lastfm radio, use its show function instead + (if (and (boundp 'emms-lastfm-radio-stream-url) + (stringp emms-lastfm-radio-stream-url) + (string= emms-lastfm-radio-stream-url file)) + (with-current-buffer buffer + (and (fboundp 'emms-lastfm-np) + (emms-lastfm-np insertp callback))) + ;; otherwise build and show the description + (when info + (when name + (setq desc name)) (when file (let ((track (emms-dictionary '*track*)) track-desc) |