Class: Shortwave::Facade::Playlist

Inherits:
Remote
  • Object
show all
Defined in:
lib/shortwave/facade/lastfm.rb

Instance Attribute Summary

Attributes inherited from Remote

#session

Instance Method Summary collapse

Methods inherited from Remote

#initialize

Constructor Details

This class inherits a constructor from Shortwave::Facade::Remote

Instance Method Details

#add_track(playlistID, track, artist) ⇒ Object

Add a track to a Last.fm user’s playlist

playlistID

The ID of the playlist - this is available in user.getPlaylists.

track

The track name to add to the playlist.

artist

The artist name that corresponds to the track to be added.



864
865
866
# File 'lib/shortwave/facade/lastfm.rb', line 864

def add_track(playlistID, track, artist)
  post(:session, {:method => "playlist.addTrack", :playlistID => playlistID, :track => track, :artist => artist})
end

#create(options = {}) ⇒ Object

Create a Last.fm playlist on behalf of a user

Options

title

Title for the playlist

description

Description for the playlist



855
856
857
# File 'lib/shortwave/facade/lastfm.rb', line 855

def create(options={})
  post(:session, {:method => "playlist.create"}.merge(options))
end

#fetch(playlistURL) ⇒ Object

Fetch XSPF playlists using a lastfm playlist url.

playlistURL

A lastfm protocol playlist url (‘lastfm://playlist/…’) . See ‘playlists’ section for more information.



871
872
873
# File 'lib/shortwave/facade/lastfm.rb', line 871

def fetch(playlistURL)
  get(:standard, {:method => "playlist.fetch", :playlistURL => playlistURL})
end