Permalink
Browse files

Update to latest ST-JSON. Hooray for open source!

  • Loading branch information...
1 parent 0d8fdc7 commit 30212682ed46498af34a1e13a756584e0258c6ac @kingcons committed May 30, 2012
Showing with 8 additions and 16 deletions.
  1. +1 −1 src/playlist.lisp
  2. +6 −6 src/track.lisp
  3. +1 −9 src/utils.lisp
View
@@ -10,7 +10,7 @@
`(("artist" . ,artists)))
,@(when song-ids
`(("song_id" . ,song-ids)))))))
- (getjso* "songs" result)))
+ (st-json:getjso* "songs" result)))
;; Bobby Tank - Circles: TRAHHWP136F598034A
;; Bondax - Just Us: TRVURQT136F05FEEF8
View
@@ -10,7 +10,7 @@
(analysis)))
(defun get-analysis (track-json)
- (let* ((url (getjso* "audio_summary.analysis_url" track-json))
+ (let* ((url (st-json:getjso* "audio_summary.analysis_url" track-json))
(params-idx (position #\? url))
;; KLUDGE: drakma::dissect-query and hunchentoot::url-decode are
;; needed just to pass the signature correctly :-/ WTF
@@ -26,26 +26,26 @@
`(("md5" . ,(md5sum file))
("bucket" . "audio_summary"))
:method :post)))
- (getjso* "track" result)))
+ (st-json:getjso* "track" result)))
(defmethod analyze ((id string))
(let ((result (echonest-call "track" "analyze"
`(("id" . ,id)
("bucket" . "audio_summary"))
:method :post)))
- (getjso* "track" result)))
+ (st-json:getjso* "track" result)))
(defmethod profile ((file pathname))
(let ((result (echonest-call "track" "profile"
`(("md5" . ,(md5sum file))
("bucket" . "audio_summary")))))
- (getjso* "track" result)))
+ (st-json:getjso* "track" result)))
(defmethod profile ((id string))
(let ((result (echonest-call "track" "profile"
`(("id" . ,id)
("bucket" . "audio_summary")))))
- (getjso* "track" result)))
+ (st-json:getjso* "track" result)))
(defmethod upload ((file pathname) &optional (wait "false"))
(let ((result (echonest-call "track" "upload"
@@ -55,4 +55,4 @@
,@(when (string= wait "true")
`(("bucket" . "audio_summary"))))
:method :post)))
- (getjso* "track" result)))
+ (st-json:getjso* "track" result)))
View
@@ -5,7 +5,7 @@
(format nil "~(~{~2,'0X~}~)" (coerce byte-vector 'list)))
(defgeneric md5sum (object)
- (:documentation "Creates an MD5 byte-array of STRING and prints it as lower-case hexadecimal."))
+ (:documentation "Creates an MD5 byte-array of OBJECT and prints it as lower-case hexadecimal."))
(defmethod md5sum ((string string))
(let ((string (string-to-octets string :external-format :utf-8)))
@@ -25,14 +25,6 @@
(st-json:getjso "response" (st-json:read-json response))
(error 'echonest-error :message response)))))
-;; Copying this here until it or similar gets merged into st-json...
-(defmacro getjso* (keys jso)
- (let ((last (position #\. keys :from-end t)))
- (if last
- `(st-json:getjso ,(subseq keys (1+ last))
- (getjso* ,(subseq keys 0 last) ,jso))
- `(st-json:getjso ,keys ,jso))))
-
;; Lovingly stolen from hunchentoot
(defun %url-decode (string)
"Decodes a URL-encoded STRING"

0 comments on commit 3021268

Please sign in to comment.