aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-lastfm.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-08-09 13:23:28 -0700
committerMichael Olson <mwolson@gnu.org>2008-08-09 13:23:48 -0700
commitafa5c8cc95dc940386fd4e2065b8dac19b72d587 (patch)
tree8ab981e28414ec8d3dd36d034456f6354111f172 /lisp/emms-lastfm.el
parentc6a98ba99332e8398f58afad0116e0018882514b (diff)
emms-lastfm: Complete artist names from cache.
* doc/emms.texinfo: Update copyright years. (Last.fm radio): Update names of functions. * lisp/emms-lastfm.el (emms-lastfm-read-artist): New function that reads an artist from the user, doing completions from the EMMS track cache if present. (emms-play-lastfm-similar-artists): Rename from emms-lastfm-radio-similar-artists. Use completion. Thanks to Thierry Volpiatto for the initial implementation (emms-play-lastfm-global-tag): Rename from emms-lastfm-radio-global-tag. (emms-play-lastfm-artist-fan): Rename from emms-lastfm-radio-artist-fan. Use completion.
Diffstat (limited to 'lisp/emms-lastfm.el')
-rw-r--r--lisp/emms-lastfm.el28
1 files changed, 21 insertions, 7 deletions
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 ()