module Audioscrobbler:Lastfm_generic.Audioscrobbler_t
http://www.audioscrobbler.net/development/protocol/
Audioscrobbler is the submission protocol as described at
http://www.audioscrobbler.net/development/protocol/
type
source =
| |
User |
| |
Broadcast |
| |
Recommendation |
| |
Lastfm |
| |
Unknown |
type
rating =
| |
Love |
| |
Ban |
| |
Skip |
type
action =
| |
NowPlaying |
| |
Submit |
type
song = {
|
artist : |
|
track : |
|
time : |
|
source : |
|
rating : |
|
length : |
|
album : |
|
trackauth : |
|
tracknumber : |
|
musicbrainzid : |
type
error =
| |
Http of |
| |
Banned |
| |
Badauth |
| |
Badtime |
| |
Failed of |
| |
UnknownError of |
| |
Success |
| |
Internal of |
| |
BadData of |
exception Error of error
val string_of_error : error -> string
val base_port : int Pervasives.ref
val base_host : string Pervasives.ref
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.
val check_song : song ->
action -> unit
Raises Error (BadData reason)
if invalid data is given.
See protocol details there:
Using this API, all requests are done in one single step
val do_np : ?timeout:float ->
?host:string * int ->
Lastfm_generic.client ->
Lastfm_generic.login -> song -> unit
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 ->
Lastfm_generic.client ->
Lastfm_generic.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.
val handshake : ?timeout:float ->
?host:string * int -> Lastfm_generic.client -> Lastfm_generic.login -> string
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 requestval submit : ?timeout:float ->
string ->
song list ->
(error * song)
list
submit sessionID tracks
execute a submit request
This functions returns a list
songs for which supplied informations
were incomplete, with corresponding exception
(see check_song)