package lastfm

  1. Overview
  2. Docs

Generic implementation of the Radio API, independant * from the Http request.

API for using lastfm radios

No protocol documentation avaible for now...

Parameters

module _ : Http_t

Signature

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 =
  1. | Http of string
  2. | Auth of string
  3. | Adjust of string * string
  4. | Playlist
  5. | Empty

Various errors

exception Error of error
val string_of_error : error -> string

Get meaning of Error e

val base_host : string Stdlib.ref

Base host. Default: "ext.last.fm"

Basic API

val get : ?timeout:float -> string -> track list

get uri performs whole process and outputs a list of metadatas,uri from given lastfm uri.

This function cannot handle well multiple anonymous requests.

If you plan to play simultaneously several anonymous radios, you better use the advanced API to keep track of every opened session.

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:

  • playlist: return the raw xml content of the playlist
  • tracks : returns the parsed playlist.

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 playlist, and anything went bad, you have to call clear to remove cached data about this session.

In any case you may also give another try, in case of inconsistent cached session data. See get source for details

val parse : string -> login * string * string option

parse uri parse the given lastfm:// uri * * returns login,station,options

val init : ?timeout:float -> login -> string

init login initiate lastfm session * * Returns the session id

val adjust : ?timeout:float -> string -> string -> (string * string) list

adjust id station adjusts lastfm station * for given session ID * * Returns a list of (variable,value) as returned * by the server. Contains settings for adjusted * radio.

val playlist : ?timeout:float -> string -> string option -> string

playlist id returns the raw xml content of the playlist

val tracks : ?timeout:float -> string -> string option -> track list

tracks id * returns a list of metadatas,uri

val clear : string -> unit

clear id closes and clear all * informations about the given session ID

OCaml

Innovation. Community. Security.