aboutsummaryrefslogtreecommitdiff
path: root/emms-lastfm.el
diff options
context:
space:
mode:
authorTassilo Horn <tassilo@member.fsf.org>2007-01-16 20:20:00 +0000
committerTassilo Horn <tassilo@member.fsf.org>2007-01-16 20:20:00 +0000
commit9dd55eed355f98f163dc45fc40f61ed9cb31da0e (patch)
tree7eb038910ef0e2a5c1b40c02a491feff4cf63748 /emms-lastfm.el
parent1e3daf1289c4d23c2b046b212dbf7ea0a567daf3 (diff)
restart-lastfm-plugin-when-md5challenge-expired.dpatch
darcs-hash:20070116202013-c06f4-ffed46f2b4507fd4aaf9d025efd052f8f169a7c0.gz
Diffstat (limited to 'emms-lastfm.el')
-rw-r--r--emms-lastfm.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/emms-lastfm.el b/emms-lastfm.el
index 1bb0b9a..bcf1c0f 100644
--- a/emms-lastfm.el
+++ b/emms-lastfm.el
@@ -209,6 +209,12 @@ the current track, too."
(interactive)
(emms-lastfm -1))
+(defun emms-lastfm-restart ()
+ "Disable and reenable the last.fm plugin. This will cause a new
+handshake."
+ (emms-lastfm-disable)
+ (emms-lastfm-enable))
+
(defun emms-lastfm-handshake-if-needed ()
(when (not (and emms-lastfm-md5-challenge
emms-lastfm-submit-url))
@@ -296,7 +302,12 @@ well or if an error occured."
(message "EMMS: \"%s\" submitted to last.fm"
(emms-track-description emms-lastfm-current-track))
(kill-buffer emms-lastfm-buffer))
- (message "EMMS: Song couldn't be submitted to last.fm"))))
+ (message "EMMS: Song couldn't be submitted to last.fm")
+ (goto-char (point-min))
+ (when (re-search-forward "^BADAUTH$" nil t)
+ ;; Somehow our md5-challenge expired...
+ (message "EMMS: Restarting last.fm plugin")
+ (emms-lastfm-restart)))))
;;; Playback of lastfm:// streams
@@ -309,9 +320,9 @@ well or if an error occured."
(defcustom emms-player-lastfm-radio (emms-player 'emms-lastfm-radio-start
'ignore ; no need to stop
'emms-lastfm-radio-playable-p)
- "*Parameters for the Last.fm radio player."
- :type '(cons symbol alist)
- :group 'emms-player-lastfm-radio)
+ "*Parameters for the Last.fm radio player."
+ :type '(cons symbol alist)
+ :group 'emms-player-lastfm-radio)
(defconst emms-lastfm-radio-base-url "http://ws.audioscrobbler.com/radio/"
"The base URL for playing lastfm:// stream.