aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2007-01-05 23:50:00 +0000
committerMichael Olson <mwolson@gnu.org>2007-01-05 23:50:00 +0000
commite8ddda19e1f8406b5a8c5c771513218b1459b734 (patch)
treef5f9b32761d8b6852f687b0e83ced79b091dccd3
parentef7fe16f8b6a1283012099998c4abea2818abd93 (diff)
emms-lastfm: Add emms-lastfm-np, which displays the current song information as a message or inserts it at point
darcs-hash:20070105235058-1bfb2-35bf242a357711d2539c8d036f6ea6c8cff87957.gz
-rw-r--r--emms-lastfm.el20
-rw-r--r--emms.texinfo11
2 files changed, 30 insertions, 1 deletions
diff --git a/emms-lastfm.el b/emms-lastfm.el
index 4c8d328..0f2ed00 100644
--- a/emms-lastfm.el
+++ b/emms-lastfm.el
@@ -427,6 +427,26 @@ high. (But then streaming a 128KHz mp3 won't be fun anyway.)"
(message "EMMS: Playing Last.fm stream."))
(message "EMMS: Bad response from Last.fm."))))
+(defun emms-lastfm-np (&optional arg)
+ "Show the currently-playing lastfm radio tune."
+ (interactive "P")
+ (emms-lastfm-radio-request-metadata
+ (lambda (status arg buffer)
+ (let (artist title)
+ (save-excursion
+ (set-buffer emms-lastfm-buffer)
+ (emms-http-decode-buffer)
+ (setq artist (emms-key-value "artist")
+ title (emms-key-value "track")))
+ (let ((msg (if title (format emms-show-format
+ (format "%s - %s" artist title))
+ "Nothing playing right now")))
+ (if (and arg title)
+ (with-current-buffer buffer
+ (insert msg))
+ (message msg)))))
+ (list arg (current-buffer))))
+
(defun emms-lastfm-radio-similar-artists (artist)
"Plays the similar artist radio of ARTIST."
(interactive "sArtist: ")
diff --git a/emms.texinfo b/emms.texinfo
index ccf44d1..8b9bfd7 100644
--- a/emms.texinfo
+++ b/emms.texinfo
@@ -1891,13 +1891,22 @@ high. (But then streaming a 128KHz mp3 won't be fun anyway.)
@end defvar
Even if you set this variable to nil (no polling) you can fetch the
-meta-informations with this function.
+meta-informations with one of the following functions.
@defun emms-lastfm-radio-request-metadata
Request the metadata of the current song and display it in the
mode-line if the `emms-mode-line' package is enabled.
@end defun
+@defun emms-lastfm-np
+Show the currently-playing lastfm radio tune.
+
+If you prefixed the command with @kbd{C-u}, the current song information
+is inserted at point.
+
+Otherwise, display a message with the current song information.
+@end defun
+
When you listen to last.fm radio you can rate or skip the current song.
@defun emms-lastfm-radio-love