aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlucas <lucas>2005-09-16 00:42:00 +0000
committerlucas <mwolson@gnu.org>2005-09-16 00:42:00 +0000
commit3b340f3c204e9cec0a69d10f6d22297ee6db1038 (patch)
tree322d3367ba28f2d03b4f5c58d942ba25e6e4d49a
parente7854c9b8b16ee118b5c7aca640f482a339d1cec (diff)
Adding emms-playlist-save and -active-save
Opening will come soon. darcs-hash:20050916004252-4f952-6ddd886a8bb95591ecdb5bd801cafadca0d9ad64.gz
-rw-r--r--emms.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/emms.el b/emms.el
index bf0189c..ea8bfb9 100644
--- a/emms.el
+++ b/emms.el
@@ -448,6 +448,34 @@ If no playlist exists, a new one is generated."
,@body)))
(put 'with-current-emms-playlist 'lisp-indent-function 0)
+;;; Saving playlists.
+
+(defun emms-playlist-save (playlist filename)
+ "Save a playlist"
+ (interactive "bPlaylist buffer name :
+FFile to save playlist as: ")
+ (let ((tracklist '())
+ (buffer (find-file-noselect filename)))
+ (condition-case nil
+ (with-current-buffer playlist
+ (save-excursion
+ (emms-playlist-first)
+ (while (emms-playlist-track-at)
+ (add-to-list 'tracklist (emms-playlist-track-at) t)
+ (emms-playlist-next))))
+ (error ""))
+ ;; tracklist complete, let's write it !
+ (set-buffer buffer)
+ (erase-buffer)
+ (prin1 tracklist buffer)
+ (insert "\n")
+ (save-buffer)
+ (kill-buffer buffer)))
+
+(defun emms-playlist-save-active (filename)
+ (interactive "FFile to save playlist as: ")
+ (emms-save-playlist emms-playlist-buffer filename))
+
;;; Point movement within the playlist buffer.
(defun emms-playlist-track-at (&optional pos)