Class: LastFM::Radio

Inherits:
Object
  • Object
show all
Defined in:
lib/lastfm/radio.rb

Class Method Summary collapse

Class Method Details

.get_playlist(params) ⇒ Object

Fetch new radio content periodically in an XSPF format.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :discovery (Boolean, optional)

    whether to request last.fm content in discovery mode

  • :rtp (Boolean, optional)

    whether the user is scrobbling or not during this session (helps content generation)

  • :buylinks (Boolean, optional)

    whether the response should contain links for purchase/download

  • :speed_multiplier (String, optional)

    the rate at which to provide the stream (supported multipliers are 1.0 and 2.0)

  • :bitrate (String, optional)

    what bitrate to stream content at, in kbps (supported bitrates are 64 and 128)

See Also:



13
14
15
16
# File 'lib/lastfm/radio.rb', line 13

def get_playlist( params )
  LastFM.requires_authentication
  LastFM.get( "radio.getPlaylist", params, :secure )
end

.search(params) ⇒ Object

Resolve the name of a resource into a station depending on which resource it is most likely to represent.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :name (String, required)

    the tag or artist name to resolve

See Also:



23
24
25
# File 'lib/lastfm/radio.rb', line 23

def search( params )
  LastFM.get( "radio.search", params )
end

.tune(params) ⇒ Object

Tune in to a Last.fm radio station.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :station (String, required)

    a ‘lastfm://…’ radio url

  • :lang (String, optional)

    the language to return the station name in, expressed as an ISO 639 alpha-2 code

See Also:



32
33
34
35
# File 'lib/lastfm/radio.rb', line 32

def tune( params )
  LastFM.requires_authentication
  LastFM.post( "radio.tune", params )
end