aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlucas <lucas>2005-09-16 11:35:00 +0000
committerlucas <mwolson@gnu.org>2005-09-16 11:35:00 +0000
commitbfc1d52754fea6bffa1ee8e549ecc074199264e1 (patch)
tree2ab103c4415cc38e7d84f45adccb65ed38736e39
parentf47307dd053f8457e7cad556cbc2933881427bbd (diff)
Adding m3u playlist format for saving.
darcs-hash:20050916113519-4f952-6b64bce74a914de5f6ccb336174e6a3fcb877da3.gz
-rw-r--r--emms.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/emms.el b/emms.el
index 2cd9a17..0f12da2 100644
--- a/emms.el
+++ b/emms.el
@@ -478,6 +478,33 @@ If no playlist exists, a new one is generated."
(interactive "FFile to save playlist as: ")
(emms-save-playlist emms-playlist-buffer filename))
+(defun emms-playlist-save-as-m3u (playlist filename)
+ (interactive "bPlaylist buffer name: \nFFile to save playlist as: ")
+ (let ((tracklist '()))
+ (condition-case nil
+ (with-current-buffer playlist
+ (save-excursion
+ (emms-playlist-first)
+ (while (emms-playlist-track-at)
+ (setq tracklist (cons (emms-playlist-track-at)
+ tracklist))
+ (emms-playlist-next))))
+ (error nil))
+ (setq tracklist (nreverse tracklist))
+ ;; tracklist complete, let's write it !
+ (with-current-buffer (find-file-noselect filename)
+ (erase-buffer)
+ (insert "#EXTM3U\n")
+ (mapc (lambda (track)
+ (let ((info (emms-info-get track)))
+ (insert "#EXTINF:")
+ (insert (emms-info-playing-time info) ",")
+ (insert (emms-info-artist info) " - " (emms-info-title info) "\n")
+ (insert (emms-track-get track 'name) "\n")))
+ tracklist)
+ (save-buffer)
+ (kill-buffer (current-buffer)))))
+
;;; Point movement within the playlist buffer.
(defun emms-playlist-track-at (&optional pos)