Added artist.gettopfans API
This commit is contained in:
parent
4d3e8eae2f
commit
39fa997665
@ -79,7 +79,7 @@
|
||||
|
||||
;;;;;;;;;; forward declaration ;;;;;;;;;;
|
||||
|
||||
(declare bio-struct artist-struct tag-struct album-struct)
|
||||
(declare bio-struct artist-struct tag-struct album-struct user-struct)
|
||||
|
||||
;;;;;;;;;; Bio/Wiki ;;;;;;;;;;
|
||||
|
||||
@ -219,6 +219,30 @@
|
||||
(defmethod artist-topalbums :name [artist-name]
|
||||
(get-artist-topalbums {:artist artist-name}))
|
||||
|
||||
;;;;;;;;;; artist.gettopfans ;;;;;;;;;;
|
||||
|
||||
(defn- parse-artist-topfans [data]
|
||||
(do
|
||||
(debug (str "parse-artist-topfans: " data))
|
||||
(vec
|
||||
(map
|
||||
#(struct-map user-struct
|
||||
:name (% :name)
|
||||
:url (% :url)
|
||||
:realname (% :realname)
|
||||
:weight (-> % :weight parseInt))
|
||||
(-> data :topfans :user)))))
|
||||
|
||||
(def #^{:private true} get-artist-topfans
|
||||
(create-get-obj-fn {:method "artist.gettopfans"} parse-artist-topfans))
|
||||
|
||||
(defmulti artist-topfans artist-or-name)
|
||||
|
||||
(defmethod artist-topfans :artist [artst]
|
||||
(-> artst :name artist-topfans))
|
||||
|
||||
(defmethod artist-topfans :name [artist-name]
|
||||
(get-artist-topfans {:artist artist-name}))
|
||||
|
||||
;;;;;;;;;; Tag ;;;;;;;;;;
|
||||
|
||||
@ -228,6 +252,10 @@
|
||||
|
||||
(defstruct album-struct :name :url :mbid :artist :playcount)
|
||||
|
||||
;;;;;;;;;; User ;;;;;;;;;;
|
||||
|
||||
(defstruct user-struct :name :url :realname)
|
||||
|
||||
(comment
|
||||
|
||||
(def *lastfm-api-key* "23caa86333d2cb2055fa82129802780a")
|
||||
|
Loading…
Reference in New Issue
Block a user