emms-help
[Top][All Lists]
Advanced

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

[emms-help] [PATCH 2/2] Made emms-lastfm-submit-track resilient to BADSE


From: Chris Gray
Subject: [emms-help] [PATCH 2/2] Made emms-lastfm-submit-track resilient to BADSESSION
Date: Mon, 10 Aug 2009 15:25:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

The API says that on a BADSESSION response, the client should
re-handshake and re-submit the track.

Signed-off-by: Chris Gray <address@hidden>
---
 lisp/emms-lastfm.el |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lisp/emms-lastfm.el b/lisp/emms-lastfm.el
index 028a221..d686cac 100644
--- a/lisp/emms-lastfm.el
+++ b/lisp/emms-lastfm.el
@@ -410,14 +410,18 @@ well or if an error occured."
     ;; response starts.
     (re-search-forward "^$" nil t)
     (forward-line)
-    (if (re-search-forward "^OK$" nil t)
-        (progn
-          (when emms-lastfm-submission-verbose-p
-            (message "EMMS: \"%s\" submitted to last.fm"
-                     (emms-track-description emms-lastfm-current-track)))
-          (kill-buffer buffer))
-      (message "EMMS: Song couldn't be submitted to last.fm: %s"
-               (emms-read-line)))))
+    (cond ((re-search-forward "^OK$" nil t)
+          (progn
+            (when emms-lastfm-submission-verbose-p
+              (message "EMMS: \"%s\" submitted to last.fm"
+                       (emms-track-description emms-lastfm-current-track)))
+            (kill-buffer buffer)))
+         ((re-search-forward "^BADSESSION$" nil t)
+          (progn
+            (emms-lastfm-handshake)
+            (emms-lastfm-submit-track)))
+         (t (message "EMMS: Song couldn't be submitted to last.fm: %s"
+                     (emms-read-line))))))
 
 ;;; Playback of lastfm:// streams
 
-- 
1.6.0.3.618.g55080






reply via email to

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