properly handle API requests sleep period
The API has a maximum request rate of 1 request/second.
A quick fix.
; sends the request and gets the JSON response
; URIString -> intarweb#response
(define (get-response-from-endpoint endpoint)
(log-message 0 (string-append "Sleeping before GET request to " endpoint))
(process-sleep 1)
(log-message 1 (string-append "Sending GET request to " endpoint))
(handle-exceptions exn
(begin
(let ((exn-message ((condition-property-accessor 'exn 'message) exn)))
(log-message 5 exn-message))
#f)
(with-input-from-request
(make-request-to-endpoint API-KEY (create-api-uri-object endpoint)) #f read-json)
))
This makes the request only after waiting a second. Very useless if it's only one request to be done; but that's the nature of a quick fix: works, but could be better. I might try a more interesting solution sometime later.
fetching album artwork
creating the tiddlers
The cover art implies the creation of two files. One of them is the image file, and the other is some meta information. Example follows:
created: 20240107203647900
modified: 20240107203656151
title: bb/ang3l - tinashe album cover
type: image/png