aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-player-mpd.el3
-rw-r--r--emms-source-file.el24
-rw-r--r--emms.el23
3 files changed, 25 insertions, 25 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el
index 176d50d..fe2bd33 100644
--- a/emms-player-mpd.el
+++ b/emms-player-mpd.el
@@ -90,6 +90,7 @@
;; emms-playing-time, the displayed time will be accurate.
(require 'emms-player-simple)
+(require 'emms-source-file) ; for emms-source-file-parse-playlist
(defun emms-player-mpd-get-supported-regexp ()
"Returns a regexp of file extensions that MusicPD supports,
@@ -509,7 +510,7 @@ This handles both m3u and pls type playlists."
;; This allows us to keep playlists anywhere and not worry about
;; having to mangle their names. Also, mpd can't handle pls
;; playlists by itself.
- (let ((playlist (emms-parse-playlist playlist))
+ (let ((playlist (emms-source-file-parse-playlist playlist))
(any-success nil))
(dolist (file playlist)
(when (emms-player-mpd-add-file file)
diff --git a/emms-source-file.el b/emms-source-file.el
index d3215a2..e2e1cec 100644
--- a/emms-source-file.el
+++ b/emms-source-file.el
@@ -149,11 +149,33 @@ or lines starting with '#'."
emms-source-file-default-directory
emms-source-file-default-directory
t)))
- (dolist (file (emms-parse-playlist playlist))
+ (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
diff --git a/emms.el b/emms.el
index 8231074..51bab04 100644
--- a/emms.el
+++ b/emms.el
@@ -872,29 +872,6 @@ ignore this."
(setq i (- i 1))))
vector)
-(defun emms-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)))
-
;;; Saving playlists.
(defun emms-playlist-save (playlist filename)