Added examples
parent
b8da6992fe
commit
94d98e3402
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
(defvar- attr-kw (keyword "@attr"))
|
(defvar- attr-kw (keyword "@attr"))
|
||||||
|
|
||||||
|
(defvar- text-kw (keyword "#text"))
|
||||||
|
|
||||||
(defn- safe-parse-int [n]
|
(defn- safe-parse-int [n]
|
||||||
(if (nil? n)
|
(if (nil? n)
|
||||||
nil
|
nil
|
||||||
|
@ -428,7 +430,7 @@
|
||||||
:mbid (-> data :artist :mbid))
|
:mbid (-> data :artist :mbid))
|
||||||
:playcount (-> data :playcount safe-parse-int)
|
:playcount (-> data :playcount safe-parse-int)
|
||||||
:listeners (-> data :listeners safe-parse-int)
|
:listeners (-> data :listeners safe-parse-int)
|
||||||
:streamable (-> data :streamable :#text str-1?)
|
:streamable (-> data :streamable text-kw str-1?)
|
||||||
:streamable-full (-> data :streamable :fulltrack str-1?)))
|
:streamable-full (-> data :streamable :fulltrack str-1?)))
|
||||||
|
|
||||||
(defvar- parse-artist-toptracks
|
(defvar- parse-artist-toptracks
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
(ns clj-lastfm.examples
|
||||||
|
(:use [clj-lastfm.core]))
|
||||||
|
|
||||||
|
(defn- indexed [s] (map vector (iterate inc 1) s))
|
||||||
|
|
||||||
|
(defn print-topten-tracks [artist-name]
|
||||||
|
(doseq [[idx name]
|
||||||
|
(->> artist-name artist-toptracks (take 10) (map :name) indexed)]
|
||||||
|
(println (format "%s. %s" idx name))))
|
|
@ -1,6 +1,6 @@
|
||||||
# Based on the example properties given at http://logging.apache.org/log4j/1.2/manual.html
|
# Based on the example properties given at http://logging.apache.org/log4j/1.2/manual.html
|
||||||
# Set root logger level to DEBUG and its only appender to A1.
|
# Set root logger level to DEBUG and its only appender to A1.
|
||||||
log4j.rootLogger=INFO,A1
|
log4j.rootLogger=ERROR,A1
|
||||||
|
|
||||||
# A1 is set to be a ConsoleAppender.
|
# A1 is set to be a ConsoleAppender.
|
||||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||||
|
|
Loading…
Reference in New Issue