Class: LastFM::Library
- Inherits:
-
Object
- Object
- LastFM::Library
- Defined in:
- lib/lastfm/library.rb
Class Method Summary collapse
-
.add_album(params) ⇒ Object
Add an album or collection of albums to a user’s Last.fm library.
-
.add_artist(params) ⇒ Object
Add an artist or collection of artists to a user’s Last.fm library.
-
.add_track(params) ⇒ Object
Add a track or collection of tracks to a user’s Last.fm library.
-
.get_albums(params) ⇒ Object
A paginated list of all the albums in a user’s library, with play counts and tag counts.
-
.get_artists(params) ⇒ Object
A paginated list of all the artists in a user’s library, with play counts and tag counts.
-
.get_tracks(params) ⇒ Object
A paginated list of all the tracks in a user’s library, with play counts and tag counts.
-
.remove_album(params) ⇒ Object
Remove an album from a user’s Last.fm library.
-
.remove_artist(params) ⇒ Object
Remove an artist from a user’s Last.fm library.
-
.remove_scrobble(params) ⇒ Object
Remove a scrobble from a user’s Last.fm library.
-
.remove_track(params) ⇒ Object
Remove a track from a user’s Last.fm library.
Class Method Details
.add_album(params) ⇒ Object
Add an album or collection of albums to a user’s Last.fm library.
10 11 12 13 14 15 16 |
# File 'lib/lastfm/library.rb', line 10 def add_album( params ) LastFM.requires_authentication # convert :artists and :albums to individual artist[i] and album[i] Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} Array(params.delete(:albums)).each_with_index{|val, i| params["album[#{i}]"] = val} LastFM.post( "library.addAlbum", params ) end |
.add_artist(params) ⇒ Object
Add an artist or collection of artists to a user’s Last.fm library.
22 23 24 25 26 |
# File 'lib/lastfm/library.rb', line 22 def add_artist( params ) LastFM.requires_authentication Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} LastFM.post( "library.addArtist", params ) end |
.add_track(params) ⇒ Object
Add a track or collection of tracks to a user’s Last.fm library.
33 34 35 36 37 38 |
# File 'lib/lastfm/library.rb', line 33 def add_track( params ) LastFM.requires_authentication Array(params.delete(:artists)).each_with_index{|val, i| params["artist[#{i}]"] = val} Array(params.delete(:tracks)).each_with_index{|val, i| params["track[#{i}]"] = val} LastFM.post( "library.addTrack", params ) end |
.get_albums(params) ⇒ Object
A paginated list of all the albums in a user’s library, with play counts and tag counts.
47 48 49 |
# File 'lib/lastfm/library.rb', line 47 def get_albums( params ) LastFM.get( "library.getAlbums", params ) end |
.get_artists(params) ⇒ Object
A paginated list of all the artists in a user’s library, with play counts and tag counts.
57 58 59 |
# File 'lib/lastfm/library.rb', line 57 def get_artists( params ) LastFM.get( "library.getArtists", params ) end |
.get_tracks(params) ⇒ Object
A paginated list of all the tracks in a user’s library, with play counts and tag counts.
69 70 71 |
# File 'lib/lastfm/library.rb', line 69 def get_tracks( params ) LastFM.get( "library.getTracks", params ) end |
.remove_album(params) ⇒ Object
Remove an album from a user’s Last.fm library.
78 79 80 81 |
# File 'lib/lastfm/library.rb', line 78 def remove_album( params ) LastFM.requires_authentication LastFM.post( "library.removeAlbum", params ) end |
.remove_artist(params) ⇒ Object
Remove an artist from a user’s Last.fm library.
87 88 89 90 |
# File 'lib/lastfm/library.rb', line 87 def remove_artist( params ) LastFM.requires_authentication LastFM.post( "library.removeArtist", params ) end |
.remove_scrobble(params) ⇒ Object
Remove a scrobble from a user’s Last.fm library.
98 99 100 101 |
# File 'lib/lastfm/library.rb', line 98 def remove_scrobble( params ) LastFM.requires_authentication LastFM.post( "library.removeScrobble", params ) end |
.remove_track(params) ⇒ Object
Remove a track from a user’s Last.fm library.
108 109 110 111 |
# File 'lib/lastfm/library.rb', line 108 def remove_track( params ) LastFM.requires_authentication LastFM.post( "library.removeTrack", params ) end |