[Top][All Lists]

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

[emms-help] Re: make emms-player-start cycle players

From: Andrea Russo
Subject: [emms-help] Re: make emms-player-start cycle players
Date: Fri, 16 Jun 2006 21:26:38 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ops, I inserted an old patch, here is the right one (anyway the only
change is in the catched error in emms-player-start: `error' instead
of `file-error')


--- old-emms2/emms.el   2006-06-16 21:22:40.000000000 +0200
+++ new-emms2/emms.el   2006-06-16 21:22:40.000000000 +0200
@@ -1218,27 +1218,33 @@
   "Return an EMMS player capable of playing TRACK.
 This will be the first player whose PLAYABLEP function returns non-nil,
 or nil if no such player exists."
-  (let ((lis emms-player-list))
-    (while (and lis
-                (not (funcall (emms-player-get (car lis) 'playablep)
-                              track)))
+  (let ((lis emms-player-list)
+       players)
+    (while lis
+      (if (funcall (emms-player-get (car lis) 'playablep)
+                  track)
+         (add-to-list 'players (car lis) t))
       (setq lis (cdr lis)))
-    (if lis
-        (car lis)
-      nil)))
+    players))
 (defun emms-player-start (track)
   "Start playing TRACK."
   (if emms-player-playing-p
       (error "A player is already playing")
-    (let ((player (emms-player-for track)))
-      (if (not player)
+    (let ((players (emms-player-for track)))
+      (if (not players)
           (error "Don't know how to play track: %S" track)
         ;; Change default-directory so we don't accidentally block any
         ;; directories the current buffer was visiting.
-        (let ((default-directory "/"))
-          (funcall (emms-player-get player 'start)
-                   track))))))
+       (let ((default-directory "/")
+             (problems t))
+         (while problems
+           (condition-case err
+               (progn
+                 (funcall (emms-player-get (car players) 'start)
+                          track)
+                 (setq problems nil))
+             (error (setq players (cdr players))))))))))
 (defun emms-player-started (player)
   "Declare that the given EMMS PLAYER has started.

<ddaa> First rule of Arch: You cannot change history.
<ddaa> Second rule of Arch: Information wants to be free.
<mnemoc> Third rule: mistakes doesn't exist?
<ddaa> Mistakes are part of history.

reply via email to

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