Module Lastfm.Radio


module Radio: sig .. end


API for using lastfm radios

No documentation avaible for now...

Types


type track = (string * string) list * string 
Type for track datas

A track is a list of "field","value" metadatas and an uri


type error =
| Http of string
| Init of string
| Adjust of string * string
| Playlist
| Empty
Various errors
exception Error of error
val string_of_error : error -> string
Get meaning of Error e

Basic API


val get : string -> track list
get uri performs whole process and outputs a list of metadatas,uri from given lastfm uri

Advanced API

Using this API you shall call:

  1. parse: get required parts of the uri
  2. init: initiate a session
  3. adjust: adjust station
Then you can use any of the following: After each of those calls, you shall use *only* one of the songs from the playlist.

The module will cache session informations and avoid redundant requests, so you might always call init and adjust.

If you call url or playlist, and anything went bad, you have to call clear to remove cached data about this session.

val parse : string -> Lastfm.login option * (string * string option)
parse uri parse the given lastfm:// uri returns login option,(station,options option)
val init : Lastfm.login option -> string
init login initiate lastfm session Returns the session id
val adjust : string -> string -> unit
adjust id station adjusts lastfm station for given session ID
val url : string -> string option -> string
url id options returns the url of the playlist
val playlist : string -> string option -> string
playlist id options returns the raw xml content of the playlist
val tracks : string -> string option -> track list
tracks id options returns a list of metadatas,uri
val clear : string -> unit
clear id closes and clear all informations about the given session ID