diff options
author | Michael Olson <mwolson@gnu.org> | 2006-04-02 02:45:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-04-02 02:45:00 +0000 |
commit | 7f7223d6655e67e4e75d54bbd57f04a47b65dba3 (patch) | |
tree | 9c8533fc2f7cb8a11914c4c64a5f9b5c68350475 /emms-source-file.el | |
parent | e1d5bf36570590809922d759be087be97ecd4d43 (diff) |
emms-source-playlist: Add support for m3u and pls playlists.
darcs-hash:20060402024556-1bfb2-da264c4af634159a12fed0e3e4425eb238b9c917.gz
Diffstat (limited to 'emms-source-file.el')
-rw-r--r-- | emms-source-file.el | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/emms-source-file.el b/emms-source-file.el index e2e1cec..6634130 100644 --- a/emms-source-file.el +++ b/emms-source-file.el @@ -140,42 +140,6 @@ value of `emms-source-file-default-directory'." (emms-track 'file file))) (emms-source-file-directory-tree dir regex))) -;;;###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))) - (dolist (file (emms-source-file-parse-playlist playlist)) - (if (string-match "\\`http://" file) - (emms-source-url file) - (emms-source-file file)))) - -(defun emms-source-file-parse-playlist (playlist) - "Extract a list of filenames from the given .m3u or .pls playlist. -Empty lines and lines starting with '#' are ignored." - (let ((files '()) - (pls-p (if (string-match "\\.pls\\'" playlist) t nil)) - (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))) - (when pls-p - (if (string-match "\\`File[0-9]*=\\(.+\\)\\'" line) - (setq line (match-string 1 line)) - (setq line ""))) - (unless (string= line "") - (setq files (cons (if (or (string-match "\\`http://" line) - (file-name-absolute-p line)) - line - (concat dir line)) - files)))))) - (reverse files))) ;;; Helper functions |