aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/emms.texinfo8
-rw-r--r--lisp/emms-lastfm.el28
2 files changed, 25 insertions, 11 deletions
diff --git a/doc/emms.texinfo b/doc/emms.texinfo
index ec8cd1a..54cd72d 100644
--- a/doc/emms.texinfo
+++ b/doc/emms.texinfo
@@ -17,7 +17,7 @@
@end direntry
@copying
- @copyright{} 2004, 2005, 2006, 2007
+ @copyright{} 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -2271,17 +2271,17 @@ currently browsed (which might not be the ``current'' playlist), use
For your convenience there are some functions which let you choose a
common radio station without having to remember or type its last.fm URL.
-@defun emms-lastfm-radio-similar-artists artist
+@defun emms-play-lastfm-similar-artists artist
Starts playing the similar artist radio of @var{artist}. When run
interactively you will be prompted for an artist name.
@end defun
-@defun emms-lastfm-radio-global-tag tag
+@defun emms-play-lastfm-global-tag tag
Starts playing the global tag radio of @var{tag}. When run interactively
you will be prompted for a tag name.
@end defun
-@defun emms-lastfm-radio-artist-fan artist
+@defun emms-play-lastfm-artist-fan artist
Starts playing the artist fan radio of @var{artist}. When run
interactively you will be prompted for an artist name.
@end defun
diff --git a/lisp/emms-lastfm.el b/lisp/emms-lastfm.el
index 11804c8..a3b3adb 100644
--- a/lisp/emms-lastfm.el
+++ b/lisp/emms-lastfm.el
@@ -58,8 +58,8 @@
;; There are some functions for conveniently playing the Similar Artists and
;; the Global Tag Radio. Here you only need to enter the band's name or the tag
;; respectively.
-;; `M-x emms-lastfm-radio-similar-artists RET Britney Spears'
-;; `M-x emms-lastfm-radio-global-tag RET pop'
+;; `M-x emms-play-lastfm-similar-artists RET Britney Spears'
+;; `M-x emms-play-lastfm-global-tag RET pop'
;; When you're listening to a Last.fm radio station you have the possibility to
;; give feedback to them. If you like the current song, type
@@ -578,21 +578,35 @@ inserting it."
(t (message msg))))))
(list insertp (current-buffer) callback)))
-(defun emms-lastfm-radio-similar-artists (artist)
+(defun emms-lastfm-read-artist ()
+ "Read an artist name from the user."
+ (let ((artists nil))
+ (when (boundp 'emms-cache-db)
+ (maphash
+ #'(lambda (file track)
+ (let ((artist (emms-track-get track 'info-artist)))
+ (when artist
+ (add-to-list 'artists artist))))
+ emms-cache-db))
+ (if artists
+ (emms-completing-read "Artist: " artists)
+ (read-string "Artist: "))))
+
+(defun emms-play-lastfm-similar-artists (artist)
"Plays the similar artist radio of ARTIST."
- (interactive "sArtist: ")
+ (interactive (list (emms-lastfm-read-artist)))
(emms-lastfm-radio (concat "lastfm://artist/"
artist
"/similarartists")))
-(defun emms-lastfm-radio-global-tag (tag)
+(defun emms-play-lastfm-global-tag (tag)
"Plays the global tag radio of TAG."
(interactive "sGlobal Tag: ")
(emms-lastfm-radio (concat "lastfm://globaltags/" tag)))
-(defun emms-lastfm-radio-artist-fan (artist)
+(defun emms-play-lastfm-artist-fan (artist)
"Plays the artist fan radio of ARTIST."
- (interactive "sArtist: ")
+ (interactive (list (emms-lastfm-read-artist)))
(emms-lastfm-radio (concat "lastfm://artist/" artist "/fans")))
(defun emms-lastfm-radio-love ()