[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] [COMMIT] emms-lastfm: Complete artist names from cache.
From: |
Michael Olson |
Subject: |
[Emms-patches] [COMMIT] emms-lastfm: Complete artist names from cache. |
Date: |
Sat, 9 Aug 2008 13:23:28 -0700 |
* 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.
---
doc/emms.texinfo | 8 ++++----
lisp/emms-lastfm.el | 28 +++++++++++++++++++++-------
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.
address@hidden emms-lastfm-radio-similar-artists artist
address@hidden 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
address@hidden emms-lastfm-radio-global-tag tag
address@hidden 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
address@hidden emms-lastfm-radio-artist-fan artist
address@hidden 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 ()
--
debian.1.5.6.1.19.ge6b2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emms-patches] [COMMIT] emms-lastfm: Complete artist names from cache.,
Michael Olson <=