emms-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emms-patches] [COMMIT] Clean up use of regexps to match supported track


From: Michael Olson
Subject: [Emms-patches] [COMMIT] Clean up use of regexps to match supported tracks.
Date: Sat, 20 Sep 2008 10:33:29 -0700

* lisp/emms-player-mpd.el (emms-player-mpd-supported-regexp): Use
  emms-player-simple-regexp.

* lisp/emms-player-mplayer.el (mplayer): Ditto.
  (mplayer-playlist): Only match http:// at beginning of filename.

* lisp/emms-player-simple.el (mikmod, alsaplayer): Don't put periods in
  extensions.  Separate URLs from extensions.

* lisp/emms-player-xine.el (xine): Use emms-player-simple-regexp.

* lisp/emms-source-playlist.el (emms-source-playlist-parse-m3u)
  (emms-source-playlist-parse-pls): Make regexp easier to read.
---
 lisp/emms-player-mpd.el      |    3 ++-
 lisp/emms-player-mplayer.el  |   12 ++++++------
 lisp/emms-player-simple.el   |    9 +++++----
 lisp/emms-player-xine.el     |   10 +++++-----
 lisp/emms-source-playlist.el |    4 ++--
 5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el
index 24a647c..948accb 100644
--- a/lisp/emms-player-mpd.el
+++ b/lisp/emms-player-mpd.el
@@ -164,7 +164,8 @@ or nil if we cannot figure it out."
   ;; Use a sane default, just in case
   (or (emms-player-mpd-get-supported-regexp)
       (concat "\\`http://\\|"
-              "\\.\\(m3u\\|ogg\\|flac\\|mp3\\|wav\\|mod\\|au\\|aiff\\)\\'"))
+              (emms-player-simple-regexp
+               "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff")))
   "Formats supported by MusicPD."
   :type 'regexp
   :set (function
diff --git a/lisp/emms-player-mplayer.el b/lisp/emms-player-mplayer.el
index c8bf466..e172015 100644
--- a/lisp/emms-player-mplayer.el
+++ b/lisp/emms-player-mplayer.el
@@ -34,15 +34,15 @@
 (require 'emms-player-simple)
 
 (define-emms-simple-player mplayer '(file url)
-  (mapconcat 'regexp-quote
-             '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
-               ".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://"; "mms://"
-               ".rm" ".rmvb" ".mp4" ".flac" ".vob" ".m4a" ".ape")
-             "\\|")
+  (concat "\\`\\(http\\|mms\\)://\\|"
+          (emms-player-simple-regexp
+           "ogg" "mp3" "wav" "mpg" "mpeg" "wmv" "wma"
+           "mov" "avi" "divx" "ogm" "asf" "mkv"
+           "rm" "rmvb" "mp4" "flac" "vob" "m4a" "ape"))
   "mplayer" "-slave" "-quiet" "-really-quiet")
 
 (define-emms-simple-player mplayer-playlist '(streamlist)
-  "http://";
+  "\\`http://";
   "mplayer" "-slave" "-quiet" "-really-quiet" "-playlist")
 
 (emms-player-set emms-player-mplayer
diff --git a/lisp/emms-player-simple.el b/lisp/emms-player-simple.el
index 6286504..08b3b7d 100644
--- a/lisp/emms-player-simple.el
+++ b/lisp/emms-player-simple.el
@@ -175,9 +175,9 @@ PLAYER is the name of the current player."
   (emms-player-simple-regexp "mp3" "ogg" "mod" "flac" "xm" "it" "ft")
   "gst-wrapper" "alsasink")
 (define-emms-simple-player mikmod '(file)
-  (emms-player-simple-regexp ".669" ".amf" ".dsm" ".far" ".gdm" ".it"
-                             ".imf" ".mod" ".med" ".mtm" ".okt" ".s3m"
-                             ".stm" ".stx" ".ult" ".apun" ".xm" ".mod")
+  (emms-player-simple-regexp "669" "amf" "dsm" "far" "gdm" "it"
+                             "imf" "mod" "med" "mtm" "okt" "s3m"
+                             "stm" "stx" "ult" "apun" "xm" "mod")
   "mikmod" "-q" "-p" "1" "-X")
 (define-emms-simple-player timidity '(file)
   (emms-player-simple-regexp "mid" "rmi" "rcp" "r36" "g18" "g36" "mfi")
@@ -186,7 +186,8 @@ PLAYER is the name of the current player."
   (emms-player-simple-regexp "mid")
   "fluidsynth" "-aalsa" "-in" "/media/music/sf/FluidR3-GM.SF2")
 (define-emms-simple-player alsaplayer '(file url)
-  (emms-player-simple-regexp ".ogg" ".mp3" ".wav" ".flac" ".pls" ".m3u" 
"http://";)
+  (concat "\\`http://\\|"
+          (emms-player-simple-regexp "ogg" "mp3" "wav" "flac" "pls" "m3u"))
   "alsaplayer" "--quiet" "--nosave" "\"--interface text\"")
 
 (emms-player-set emms-player-alsaplayer
diff --git a/lisp/emms-player-xine.el b/lisp/emms-player-xine.el
index 715dec9..61fd11c 100644
--- a/lisp/emms-player-xine.el
+++ b/lisp/emms-player-xine.el
@@ -35,11 +35,11 @@
 (require 'emms-player-simple)
 
 (define-emms-simple-player xine '(file url)
-  (mapconcat 'regexp-quote
-             '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
-               ".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://"; "mms://"
-               ".rm" ".rmvb" ".mp4" ".flac" ".vob")
-             "\\|")
+  (concat "\\`\\(http\\|mms\\)://\\|"
+          (emms-player-simple-regexp
+           "ogg" "mp3" "wav" "mpg" "mpeg" "wmv" "wma"
+           "mov" "avi" "divx" "ogm" "asf" "mkv"
+           "rm" "rmvb" "mp4" "flac" "vob"))
   "xine" "--no-gui" "--no-logo" "--no-splash" "--no-reload" "--stdctl")
 
 (emms-player-set emms-player-xine
diff --git a/lisp/emms-source-playlist.el b/lisp/emms-source-playlist.el
index 3db4ba2..6c580f3 100644
--- a/lisp/emms-source-playlist.el
+++ b/lisp/emms-source-playlist.el
@@ -265,7 +265,7 @@ detected and simply return non-nil always."
 (defun emms-source-playlist-parse-m3u ()
   "Parse the m3u playlist in the current buffer."
   (mapcar (lambda (file)
-            (if (string-match "\\`http://\\|\\`mms://" file)
+            (if (string-match "\\`\\(http\\|mms\\)://" file)
                 (emms-track 'url file)
               (emms-track 'file file)))
           (emms-source-playlist-m3u-files)))
@@ -333,7 +333,7 @@ OUT should be the buffer where tracks are stored in m3u 
format."
 (defun emms-source-playlist-parse-pls ()
   "Parse the pls playlist in the current buffer."
   (mapcar (lambda (file)
-            (if (string-match "\\`http://\\|\\`mms://" file)
+            (if (string-match "\\`\\(http\\|mms\\)://" file)
                 (emms-track 'url file)
               (emms-track 'file file)))
           (emms-source-playlist-pls-files)))
-- 
debian.1.5.6.1.19.ge6b2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]