Library
Module
Module type
Parameter
Class
Class type
Generic implementation of Audioscrobbler, independent * from the Http request.
Audioscrobbler is the submission protocol as described at
http://www.audioscrobbler.net/development/protocol/
type song = {
artist : string;
track : string;
time : float option;
source : source option;
rating : rating option;
length : float option;
album : string option;
trackauth : string option;
tracknumber : int option;
musicbrainzid : string option;
}
song submission type
exception Error of error
val string_of_error : error -> string
Get meaning of Error e
val base_port : int ref
Base port. Default: 80
val base_host : string ref
Base host. Default: "post.audioscrobbler.com"
Functions common to both basic and advanced APIs
val get_song :
?time:float ->
?source:source ->
?rating:rating ->
?length:float ->
?album:string ->
?tracknumber:int ->
?musicbrainzid:string ->
?trackauth:string ->
artist:string ->
track:string ->
unit ->
song
get_song
create a song record based on given values.
Optional records can be ommited there.
Check wether required song informations are supplied for given action.
Raises Error (BadData reason)
if invalid data is given.
See protocol details there:
Using this API, all requests are done in one single step
do_np client login song
execute a nowplaying request with authentification
Optional host parameter is a pair "host",port to override the global values.
val do_submit :
?timeout:float ->
?host:(string * int) ->
client ->
login ->
song list ->
(error * song) list
do_submit client login songs
execute a nowplaying request with authentification.
This functions returns a list songs for which supplied informations were incomplete, with corresponding exception (see check_song
source)
This API is for advanced usages.
You may use it this way:
The module will cache session informations and avoid redundant requests, so you might always call handshake.
However, if a np or submit fails, it can be because the session has expired on server side, but the module cache still refered to it. So you might clear this session id, and try another handshake+submit/np.
Check do_no and do_submit for examples.
handshake client login
open session, returns session ID
Optional host parameter is a pair "host",port to override the global values.
val np : ?timeout:float -> string -> song -> unit
np sessionID track
execute a nowplaying request