diff options
author | Michael Olson <mwolson@gnu.org> | 2006-01-07 05:33:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-01-07 05:33:00 +0000 |
commit | b215622aad016d7e39fda64809579bf2be0d3783 (patch) | |
tree | 386d95d996ada4725b1771f0ee3caaccea798415 /emms-source-file.el | |
parent | 65dc3b56ef44b83fcb4f87cf8bf397fe0a8402e8 (diff) |
Rename m3u-playlist source to "playlist" and support .pls files. The playlist-parsing routine has been moved to a separate function, since the MusicPD player also needs to use it. Detect URLs in playlists and use type of 'url when creating tracks for them.
darcs-hash:20060107053310-1bfb2-dc5bf155e440294ee4a91b08033fa4b4242695ab.gz
Diffstat (limited to 'emms-source-file.el')
-rw-r--r-- | emms-source-file.el | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/emms-source-file.el b/emms-source-file.el index f00ffe6..2da8d47 100644 --- a/emms-source-file.el +++ b/emms-source-file.el @@ -142,28 +142,19 @@ value of `emms-source-file-default-directory'." ;; FIXME! Does this work? -js -;;;###autoload (autoload 'emms-play-m3u-playlist "emms-source-file" nil t) -;;;###autoload (autoload 'emms-add-m3u-playlist "emms-source-file" nil t) -(define-emms-source m3u-playlist (playlist) - "A source for simple .m3u playlists. It ignores empty lines, or -lines starting with '#'." +;;;###autoload (autoload 'emms-play-playlist "emms-source-file" nil t) +;;;###autoload (autoload 'emms-add-playlist "emms-source-file" nil t) +(define-emms-source playlist (playlist) + "A source for .m3u and .pls playlists. It ignores empty lines, +or lines starting with '#'." (interactive (list (read-file-name "Play file: " emms-source-file-default-directory emms-source-file-default-directory t))) - (emms-source-files - (let ((files '()) - (dir (file-name-directory playlist))) - (with-temp-buffer - (insert-file-contents playlist) - (goto-char (point-min)) - (while (re-search-forward "^[^# ].*$" nil t) - (let ((line (match-string 0))) - (setq files (cons (if (file-name-absolute-p line) - line - (concat dir line)) - files))))) - (reverse files)))) + (dolist (file (emms-parse-playlist playlist)) + (if (string-match "\\`http://" file) + (emms-source-url file) + (emms-source-file file)))) ;;; Helper functions |