rscrobbler 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/lastfm/album.rb +50 -112
- data/lib/lastfm/api/album.rb +140 -0
- data/lib/lastfm/api/artist.rb +243 -0
- data/lib/lastfm/api/auth.rb +35 -0
- data/lib/lastfm/api/chart.rb +63 -0
- data/lib/lastfm/api/event.rb +71 -0
- data/lib/lastfm/api/geo.rb +125 -0
- data/lib/lastfm/api/group.rb +69 -0
- data/lib/lastfm/api/library.rb +117 -0
- data/lib/lastfm/api/playlist.rb +40 -0
- data/lib/lastfm/api/radio.rb +41 -0
- data/lib/lastfm/api/tag.rb +120 -0
- data/lib/lastfm/api/tasteometer.rb +37 -0
- data/lib/lastfm/api/track.rb +272 -0
- data/lib/lastfm/api/user.rb +266 -0
- data/lib/lastfm/api/venue.rb +40 -0
- data/lib/lastfm/artist.rb +42 -204
- data/lib/lastfm/buylink.rb +34 -0
- data/lib/lastfm/event.rb +57 -66
- data/lib/lastfm/shout.rb +20 -0
- data/lib/lastfm/struct.rb +34 -0
- data/lib/lastfm/tag.rb +24 -89
- data/lib/lastfm/track.rb +51 -242
- data/lib/lastfm/venue.rb +21 -36
- data/lib/lastfm/wiki.rb +20 -0
- data/lib/rscrobbler.rb +24 -11
- data/test/test_album.rb +36 -0
- metadata +25 -45
- data/lib/lastfm/auth.rb +0 -35
- data/lib/lastfm/chart.rb +0 -63
- data/lib/lastfm/geo.rb +0 -125
- data/lib/lastfm/group.rb +0 -69
- data/lib/lastfm/library.rb +0 -117
- data/lib/lastfm/playlist.rb +0 -40
- data/lib/lastfm/radio.rb +0 -41
- data/lib/lastfm/tasteometer.rb +0 -37
- data/lib/lastfm/user.rb +0 -266
- data/test/unit/lib/lastfm/album_test.rb +0 -0
- data/test/unit/lib/lastfm/artist_test.rb +0 -0
- data/test/unit/lib/lastfm/auth_test.rb +0 -0
- data/test/unit/lib/lastfm/chart_test.rb +0 -0
- data/test/unit/lib/lastfm/event_test.rb +0 -0
- data/test/unit/lib/lastfm/geo_test.rb +0 -0
- data/test/unit/lib/lastfm/group_test.rb +0 -0
- data/test/unit/lib/lastfm/library_test.rb +0 -0
- data/test/unit/lib/lastfm/playlist_test.rb +0 -0
- data/test/unit/lib/lastfm/radio_test.rb +0 -0
- data/test/unit/lib/lastfm/tag_test.rb +0 -0
- data/test/unit/lib/lastfm/tasteometer_test.rb +0 -0
- data/test/unit/lib/lastfm/track_test.rb +0 -0
- data/test/unit/lib/lastfm/user_test.rb +0 -0
- data/test/unit/lib/lastfm/venue_test.rb +0 -0
- data/test/unit/lib/rscrobbler_test.rb +0 -0
@@ -0,0 +1,272 @@
|
|
1
|
+
module LastFM
|
2
|
+
module Api
|
3
|
+
class Track
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# Add a list of user supplied tags to a track.
|
7
|
+
#
|
8
|
+
# @option params [String, required] :artist the artist name
|
9
|
+
# @option params [String, required] :track the track name
|
10
|
+
# @option params [Array, required] :tags array of tags to apply to this track. accepts a maximum of 10.
|
11
|
+
# @see http://www.last.fm/api/show?service=304
|
12
|
+
def add_tags( params )
|
13
|
+
LastFM.requires_authentication
|
14
|
+
LastFM.post( "track.addTags", params )
|
15
|
+
end
|
16
|
+
|
17
|
+
# Ban a track for the current user.
|
18
|
+
#
|
19
|
+
# @option params [String, required] :artist the artist name
|
20
|
+
# @option params [String, required] :track the track name
|
21
|
+
# @see http://www.last.fm/api/show?service=261
|
22
|
+
def ban( params )
|
23
|
+
LastFM.requires_authentication
|
24
|
+
LastFM.post( "track.ban", params )
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get a list of buy Links for a track.
|
28
|
+
#
|
29
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
30
|
+
# @option params [String, required unless :mbid] :track the track name
|
31
|
+
# @option params [String, required] :country a country name, as defined by ISO 3166-1
|
32
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
33
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
34
|
+
# @return [Array<LastFM::Buylink>] collection of links where this track can be bought or downloaded
|
35
|
+
# @see http://www.last.fm/api/show?service=431
|
36
|
+
def get_buylinks( params )
|
37
|
+
xml = LastFM.get( "track.getBuylinks", params )
|
38
|
+
[:physical, :download].each_with_object([]) do |type, buylinks|
|
39
|
+
xml.find("affiliations/#{type}s/affiliation").each do |buylink|
|
40
|
+
buylinks << LastFM::Buylink.from_xml( buylink, :type => type )
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track
|
46
|
+
#
|
47
|
+
# @option params [String, required] :artist the artist name to correct
|
48
|
+
# @option params [String, required] :track the track name to correct
|
49
|
+
# @see http://www.last.fm/api/show?service=447
|
50
|
+
def get_correction( params )
|
51
|
+
LastFM.get( "track.getCorrection", params )
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retrieve track metadata associated with a fingerprint id generated by the Last.fm Fingerprinter.
|
55
|
+
# Returns track elements, along with a 'rank' value between 0 and 1 reflecting the confidence for
|
56
|
+
# each match.
|
57
|
+
#
|
58
|
+
# @option params [String, required] :fingerprint_id the fingerprint id to look up
|
59
|
+
# @see http://www.last.fm/api/show?service=441
|
60
|
+
# @see https://github.com/lastfm/Fingerprinter
|
61
|
+
# @see http://blog.last.fm/2010/07/09/fingerprint-api-and-app-updated
|
62
|
+
def get_fingerprint_metadata( params )
|
63
|
+
LastFM.get( "track.getFingerPrintMetadata", params )
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get the metadata for a track.
|
67
|
+
#
|
68
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
69
|
+
# @option params [String, required unless :mbid] :track the track name
|
70
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
71
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
72
|
+
# @option params [String, optional] :username username whose playcount for, and whether they've loved, this track is to be returned in the reponse
|
73
|
+
# @return [LastFM::Track] track constructed from the metadata contained in the response
|
74
|
+
# @see http://www.last.fm/api/show?service=356
|
75
|
+
def get_info( params )
|
76
|
+
xml = LastFM.get( "track.getInfo", params )
|
77
|
+
LastFM::Track.from_xml( xml )
|
78
|
+
end
|
79
|
+
|
80
|
+
# Get shouts for a track.
|
81
|
+
#
|
82
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
83
|
+
# @option params [String, required unless :mbid] :track the track name
|
84
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
85
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
86
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
87
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
88
|
+
# @return [Array<LastFM::Shout>] collection of shouts
|
89
|
+
# @see http://www.last.fm/api/show?service=453
|
90
|
+
def get_shouts( params )
|
91
|
+
xml = LastFM.get( "track.getShouts", params )
|
92
|
+
xml.find('shouts/shout').map do |shout|
|
93
|
+
LastFM::Shout.from_xml( shout )
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Get similar tracks for a track on Last.fm, based on listening data.
|
98
|
+
#
|
99
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
100
|
+
# @option params [String, required unless :mbid] :track the track name
|
101
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
102
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
103
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch. defaults to 50
|
104
|
+
# @return [Array<LastFM::Track>] similar tracks, ordered by similarity
|
105
|
+
# @see http://www.last.fm/api/show?service=319
|
106
|
+
def get_similar( params )
|
107
|
+
xml = LastFM.get( "track.getSimilar", params )
|
108
|
+
xml.find('similartracks/track').map do |track|
|
109
|
+
LastFM::Track.from_xml( track )
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Get the tags on a track.
|
114
|
+
#
|
115
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
116
|
+
# @option params [String, required unless :mbid] :track the track name
|
117
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
118
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
119
|
+
# @option params [String, optional] :user if called in non-authenticated mode you must specify the user to look up
|
120
|
+
# @see http://www.last.fm/api/show?service=320
|
121
|
+
def get_tags( params )
|
122
|
+
secure = !params.include?(:user)
|
123
|
+
LastFM.requires_authentication if secure
|
124
|
+
LastFM.post( "track.getTags", params, secure )
|
125
|
+
end
|
126
|
+
|
127
|
+
# Get the top fans for a track, based on listening data.
|
128
|
+
#
|
129
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
130
|
+
# @option params [String, required unless :mbid] :track the track name
|
131
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
132
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
133
|
+
# @see http://www.last.fm/api/show?service=312
|
134
|
+
def get_top_fans( params )
|
135
|
+
LastFM.get( "track.getTopFans", params )
|
136
|
+
end
|
137
|
+
|
138
|
+
# Get the top fans for a track, ordered by tag count.
|
139
|
+
#
|
140
|
+
# @option params [String, required unless :mbid] :artist the artist name
|
141
|
+
# @option params [String, required unless :mbid] :track the track name
|
142
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
143
|
+
# @option params [Boolean, optional] :autocorrect correct misspelled artist and track names to be returned in the response
|
144
|
+
# @return [Array<LastFM::Tag>] list of tags ordered by popularity
|
145
|
+
# @see http://www.last.fm/api/show?service=289
|
146
|
+
def get_top_tags( params )
|
147
|
+
xml = LastFM.get( "track.getTopTags", params )
|
148
|
+
xml.find('toptags/tag').map do |tag|
|
149
|
+
LastFM::Tag.from_xml( tag )
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Love a track for the current user.
|
154
|
+
#
|
155
|
+
# @option params [String, required] :artist the artist name
|
156
|
+
# @option params [String, required] :track the track name
|
157
|
+
# @see http://www.last.fm/api/show?service=260
|
158
|
+
def love( params )
|
159
|
+
LastFM.requires_authentication
|
160
|
+
LastFM.post( "track.love", params )
|
161
|
+
end
|
162
|
+
|
163
|
+
# Remove a user's tag from a track.
|
164
|
+
#
|
165
|
+
# @option params [String, required] :artist the artist name
|
166
|
+
# @option params [String, required] :track the track name
|
167
|
+
# @option params [String, required] :tag a single user tag to remove from this track
|
168
|
+
# @see http://www.last.fm/api/show?service=316
|
169
|
+
def remove_tag( params )
|
170
|
+
LastFM.requires_authentication
|
171
|
+
LastFM.post( "track.removeTag", params )
|
172
|
+
end
|
173
|
+
|
174
|
+
# Used to add a track-play to a user's profile. Scrobble a track, or a batch of tracks.
|
175
|
+
# Single tracks may be passed using the Object types listed, batches of tracks must be
|
176
|
+
# passed in as Arrays of each Object type. Allows up to a maximum of 50 scrobbles per
|
177
|
+
# batch. For batch scrobbles, Array indices of optional parameters must line up with
|
178
|
+
# the indicies of their corresponding tracks.
|
179
|
+
#
|
180
|
+
# @option params [String, required unless :mbid] :artist artist name
|
181
|
+
# @option params [String, required unless :mbid] :track track name
|
182
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
183
|
+
# @option params [Time, optional] :timestamp time the track started playing
|
184
|
+
# @option params [String, optional] :album album name
|
185
|
+
# @option params [String, optional] :album_artist album artist, if this differend from the track artist
|
186
|
+
# @option params [Fixnum, optional] :track_number track number of the track on the album
|
187
|
+
# @option params [Fixnum, optional] :duration track length, in seconds
|
188
|
+
# @option params [String, optional] :stream_id track stream id, received from the radio.getPlaylist service
|
189
|
+
# @option params [Boolean, optional] :chosen_by_user whether or not the user chose the track
|
190
|
+
# @option params [String, optional] :context sub-client version (not public, only enabled for certain api keys)
|
191
|
+
# @see http://www.last.fm/api/show?service=443
|
192
|
+
def scrobble( params )
|
193
|
+
LastFM.requires_authentication
|
194
|
+
# Tracks are passed to the service using array notation for each of the above params
|
195
|
+
array_params = {}
|
196
|
+
params.each do |hkey, hval|
|
197
|
+
hval = hval.to_i if hval.is_a?(Time)
|
198
|
+
Array(hval).each_with_index do |aval, index|
|
199
|
+
array_params["#{hkey}[#{index}]"] = aval
|
200
|
+
end
|
201
|
+
end
|
202
|
+
LastFM.post( "track.scrobble", array_params )
|
203
|
+
end
|
204
|
+
|
205
|
+
# Search for a track by track name. Returns track matches sorted by relevance.
|
206
|
+
#
|
207
|
+
# @option params [String, required] :track the track name
|
208
|
+
# @option params [String, optional] :artist narrow results based on an artist
|
209
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
210
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
211
|
+
# @return [Array<LastFM::Track>] list of tracks sorted by relevance
|
212
|
+
# @see http://www.last.fm/api/show?service=286
|
213
|
+
def search( params )
|
214
|
+
xml = LastFM.get( "track.search", params )
|
215
|
+
xml.find('results/trackmatches/track').map do |track|
|
216
|
+
LastFM::Track.from_xml( track )
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Share a track twith one or more Last.fm users or other friends.
|
221
|
+
#
|
222
|
+
# @option params [String, required] :artist the artist name
|
223
|
+
# @option params [String, required] :track the track name
|
224
|
+
# @option params [Array, required] :recipient a list of email addresses or Last.fm usernames. maximum is 10
|
225
|
+
# @option params [String, optional] :message an optional message to send. if not supplied a default message will be used
|
226
|
+
# @option params [Boolean, optional] :public optionally show in the sharing users activity feed. defaults to false
|
227
|
+
# @see http://www.last.fm/api/show?service=305
|
228
|
+
def share( params )
|
229
|
+
LastFM.requires_authentication
|
230
|
+
LastFM.post( "track.share", params )
|
231
|
+
end
|
232
|
+
|
233
|
+
# Unban a track for the current user.
|
234
|
+
#
|
235
|
+
# @option params [String, required] :artist the artist name
|
236
|
+
# @option params [String, required] :track the track name
|
237
|
+
# @see http://www.last.fm/api/show?service=449
|
238
|
+
def unban( params )
|
239
|
+
LastFM.requires_authentication
|
240
|
+
LastFM.post( "track.unban", params )
|
241
|
+
end
|
242
|
+
|
243
|
+
# Unlove a track for the current user.
|
244
|
+
#
|
245
|
+
# @option params [String, required] :artist the artist name
|
246
|
+
# @option params [String, required] :track the track name
|
247
|
+
# @see http://www.last.fm/api/show?service=440
|
248
|
+
def unlove( params )
|
249
|
+
LastFM.requires_authentication
|
250
|
+
LastFM.post( "track.unlove", params )
|
251
|
+
end
|
252
|
+
|
253
|
+
# Used to notify Last.fm that a user has started listening to a track.
|
254
|
+
#
|
255
|
+
# @option params [String, required unless :mbid] :artist artist name
|
256
|
+
# @option params [String, required unless :mbid] :track track name
|
257
|
+
# @option params [String, optional] :mbid the musicbrainz id for the track
|
258
|
+
# @option params [String, optional] :album album name
|
259
|
+
# @option params [String, optional] :album_artist album artist, if this differend from the track artist
|
260
|
+
# @option params [Fixnum, optional] :track_number track number of the track on the album
|
261
|
+
# @option params [Fixnum, optional] :duration track length, in seconds
|
262
|
+
# @option params [String, optional] :context sub-client version (not public, only enabled for certain api keys)
|
263
|
+
# @see http://www.last.fm/api/show?service=454
|
264
|
+
def update_now_playing( params )
|
265
|
+
LastFM.requires_authentication
|
266
|
+
LastFM.post( "track.updateNowPlaying", params )
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
module LastFM
|
2
|
+
module Api
|
3
|
+
class User
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# Get a list of tracks by a given artist scrobbled by this user,
|
7
|
+
# including scrobble time. Can be limited to specific timeranges,
|
8
|
+
# defaults to all time.
|
9
|
+
#
|
10
|
+
# @option params [String, required] :user last.fm username to fetch the recent tracks for
|
11
|
+
# @option params [String, required] :artist the artist name to fetch tracks for
|
12
|
+
# @option params [Time, optional] :startTimestamp a unix timestamp to start at
|
13
|
+
# @option params [Time, optional] :endTimestamp a unix timestamp to end at
|
14
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
15
|
+
# @see http://www.last.fm/api/show?service=432
|
16
|
+
def get_artist_tracks( params )
|
17
|
+
LastFM.get( "user.getArtistTracks", params )
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get a list of tracks banned by a user.
|
21
|
+
#
|
22
|
+
# @option params [String, required] :user last.fm username
|
23
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
24
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
25
|
+
# @see http://www.last.fm/api/show?service=448
|
26
|
+
def get_banned_tracks( params )
|
27
|
+
LastFM.get( "user.getBannedTracks", params )
|
28
|
+
end
|
29
|
+
|
30
|
+
# Get a list of upcoming events that this user is attending.
|
31
|
+
#
|
32
|
+
# @option params [String, required] :user last.fm username
|
33
|
+
# @option params [Boolean, optional] :festivalsonly whether only festivals should be returned, or all events
|
34
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
35
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
36
|
+
# @see http://www.last.fm/api/show?service=291
|
37
|
+
def get_events( params )
|
38
|
+
LastFM.get( "user.getEvents", params )
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get a list of the user's friends on Last.fm.
|
42
|
+
#
|
43
|
+
# @option params [String, required] :user last.fm username
|
44
|
+
# @option params [Boolean, optional] :recenttracks whether or not to include information about friends' recent listening in the response.
|
45
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
46
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
47
|
+
# @see http://www.last.fm/api/show?service=263
|
48
|
+
def get_friends( params )
|
49
|
+
LastFM.get( "user.getFriends", params )
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get information about a user profile.
|
53
|
+
#
|
54
|
+
# @option params [String, optional] :user user to fetch info for. defaults to the authenticated user
|
55
|
+
# @see http://www.last.fm/api/show?service=344
|
56
|
+
def get_info( params )
|
57
|
+
LastFM.get( "user.getInfo", params )
|
58
|
+
end
|
59
|
+
|
60
|
+
# Get a list of tracks loved by a user.
|
61
|
+
#
|
62
|
+
# @option params [String, required] :user last.fm username
|
63
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
64
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
65
|
+
# @see http://www.last.fm/api/show?service=329
|
66
|
+
def get_loved_tracks( params )
|
67
|
+
LastFM.get( "user.getLovedTracks", params )
|
68
|
+
end
|
69
|
+
|
70
|
+
# Get a list of a user's neighbours on Last.fm.
|
71
|
+
#
|
72
|
+
# @option params [String, required] :user last.fm username
|
73
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
74
|
+
# @see http://www.last.fm/api/show?service=264
|
75
|
+
def get_neighbors( params )
|
76
|
+
LastFM.get( "user.getNeighbonrs", params )
|
77
|
+
end
|
78
|
+
|
79
|
+
# Gets a list of upcoming releases based on a user's musical taste.
|
80
|
+
#
|
81
|
+
# @option params [String, required] :user last.fm username
|
82
|
+
# @option params [Boolean, optional] :userecs if true, return new releases based on artist recommendations. otherwise, it is based on their library (the default)
|
83
|
+
# @see http://www.last.fm/api/show?service=444
|
84
|
+
def get_new_releases( params )
|
85
|
+
LastFM.get( "user.getNewReleases", params )
|
86
|
+
end
|
87
|
+
|
88
|
+
# Get a list of all events a user has attended in the past.
|
89
|
+
#
|
90
|
+
# @option params [String, required] :user last.fm username
|
91
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
92
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
93
|
+
# @see http://www.last.fm/api/show?service=343
|
94
|
+
def get_past_events( params )
|
95
|
+
LastFM.get( "user.getPastEvents", params )
|
96
|
+
end
|
97
|
+
|
98
|
+
# Get the user's personal tags.
|
99
|
+
#
|
100
|
+
# @option params [String, required] :user last.fm username
|
101
|
+
# @option params [String, required] :tag the tag you're interested in
|
102
|
+
# @option params [String, required] :taggingtype the type of items which have been tagged. accepted types are 'artist', 'album', or 'track'
|
103
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
104
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
105
|
+
# @see http://www.last.fm/api/show?service=455
|
106
|
+
def get_personal_tags( params )
|
107
|
+
LastFM.get( "user.getPersonalTags", params )
|
108
|
+
end
|
109
|
+
|
110
|
+
# Get a list of a user's playlists.
|
111
|
+
#
|
112
|
+
# @option params [String, required] :user last.fm username
|
113
|
+
# @see http://www.last.fm/api/show?service=313
|
114
|
+
def get_playlists( params )
|
115
|
+
LastFM.get( "user.getPlaylists", params )
|
116
|
+
end
|
117
|
+
|
118
|
+
# Get a list of the recent Stations listened to by a user.
|
119
|
+
#
|
120
|
+
# @option params [String, required] :user last.fm username
|
121
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
122
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
123
|
+
# @see http://www.last.fm/api/show?service=414
|
124
|
+
def get_recent_stations( params )
|
125
|
+
LastFM.requires_authentication
|
126
|
+
LastFM.get( "user.getRecentStations", params, :secure )
|
127
|
+
end
|
128
|
+
|
129
|
+
# Get a list of the recent tracks listened to by a user. Also includes
|
130
|
+
# the currently playing track with the nowplaying="true" attribute if
|
131
|
+
# the user is currently listening.
|
132
|
+
#
|
133
|
+
# @option params [String, required] :user last.fm username
|
134
|
+
# @option params [Time, optional] :from display scrobbles after this time, formatted as unix UTC integer timestamp
|
135
|
+
# @option params [Time, optional] :to display scrobbles before this time, formatted as unix UTC integer timestamp
|
136
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
137
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
138
|
+
# @see http://www.last.fm/api/show?service=278
|
139
|
+
def get_recent_tracks( params )
|
140
|
+
LastFM.get( "user.getRecentTracks", params )
|
141
|
+
end
|
142
|
+
|
143
|
+
# Get Last.fm artist recommendations for a user.
|
144
|
+
#
|
145
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
146
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
147
|
+
# @see http://www.last.fm/api/show?service=388
|
148
|
+
def get_recommended_artists( params )
|
149
|
+
LastFM.requires_authentication
|
150
|
+
LastFM.get( "user.getRecommendedArtists", params, :secure )
|
151
|
+
end
|
152
|
+
|
153
|
+
# Get a paginated list of all events recommended to a user by Last.fm, based on their listening profile.
|
154
|
+
#
|
155
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
156
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
157
|
+
# @see http://www.last.fm/api/show?service=375
|
158
|
+
def get_recommended_events( params )
|
159
|
+
LastFM.requires_authentication
|
160
|
+
LastFM.get( "user.getRecommendedEvents", params, :secure )
|
161
|
+
end
|
162
|
+
|
163
|
+
# Get shouts for a user.
|
164
|
+
#
|
165
|
+
# @option params [String, required] :user last.fm username
|
166
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
167
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
168
|
+
# @see http://www.last.fm/api/show?service=401
|
169
|
+
def get_shouts( params )
|
170
|
+
LastFM.get( "user.getShouts", params, :secure )
|
171
|
+
end
|
172
|
+
|
173
|
+
# Get the top albums listened to by a user, based on an optional time period.
|
174
|
+
#
|
175
|
+
# @option params [String, required] :user last.fm username
|
176
|
+
# @option params [String, optional] :period time period over which to retrieve top albums for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
|
177
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
178
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
179
|
+
# @see http://www.last.fm/api/show?service=299
|
180
|
+
def get_top_albums( params )
|
181
|
+
LastFM.get( "user.getTopAlbums", params )
|
182
|
+
end
|
183
|
+
|
184
|
+
# Get the top artists listened to by a user, based on an optional time period.
|
185
|
+
#
|
186
|
+
# @option params [String, required] :user last.fm username
|
187
|
+
# @option params [String, optional] :period time period over which to retrieve top artists for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
|
188
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
189
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
190
|
+
# @see http://www.last.fm/api/show?service=300
|
191
|
+
def get_top_artists( params )
|
192
|
+
LastFM.get( "user.getTopArtists", params )
|
193
|
+
end
|
194
|
+
|
195
|
+
# Get the top tags used by a user.
|
196
|
+
#
|
197
|
+
# @option params [String, required] :user last.fm username
|
198
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
199
|
+
# @see http://www.last.fm/api/show?service=123
|
200
|
+
def get_top_tags( params )
|
201
|
+
LastFM.get( "user.getTopTags", params )
|
202
|
+
end
|
203
|
+
|
204
|
+
# Get the top tracks listened to by a user, based on an optional time period.
|
205
|
+
#
|
206
|
+
# @option params [String, required] :user last.fm username
|
207
|
+
# @option params [String, optional] :period time period over which to retrieve top tracks for. accepted values are 'overall', '7day', '3month', '6month' or '12month'
|
208
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
209
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
210
|
+
# @see http://www.last.fm/api/show?service=301
|
211
|
+
def get_top_tracks( params )
|
212
|
+
LastFM.get( "user.getTopTracks", params )
|
213
|
+
end
|
214
|
+
|
215
|
+
# Get an album chart for a user, for a given date range. Defaults to the most recent chart.
|
216
|
+
#
|
217
|
+
# @option params [String, required] :user last.fm username
|
218
|
+
# @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
|
219
|
+
# @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
|
220
|
+
# @see http://www.last.fm/api/show?service=279
|
221
|
+
def get_weekly_album_chart( params )
|
222
|
+
LastFM.get( "user.getWeeklyAlbumChart", params )
|
223
|
+
end
|
224
|
+
|
225
|
+
# Get an artist chart for a user, for a given date range. Defaults to the most recent chart.
|
226
|
+
#
|
227
|
+
# @option params [String, required] :user last.fm username
|
228
|
+
# @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
|
229
|
+
# @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
|
230
|
+
# @see http://www.last.fm/api/show?service=281
|
231
|
+
def get_weekly_artist_chart( params )
|
232
|
+
LastFM.get( "user.getWeeklyArtistChart", params )
|
233
|
+
end
|
234
|
+
|
235
|
+
# Get a list of available charts for this user, expressed as date ranges which can be sent to the chart services.
|
236
|
+
#
|
237
|
+
# @option params [String, required] :user last.fm username
|
238
|
+
# @see http://www.last.fm/api/show?service=280
|
239
|
+
def get_weekly_chart_list( params )
|
240
|
+
LastFM.get( "user.getWeeklyChartList", params )
|
241
|
+
end
|
242
|
+
|
243
|
+
# Get a track chart for a user, for a given date range. Defaults to the most recent chart.
|
244
|
+
#
|
245
|
+
# @option params [String, required] :user last.fm username
|
246
|
+
# @option params [String, optional] :from date at which the chart should start. (see: User.get_weekly_chart_list)
|
247
|
+
# @option params [String, optional] :to date at which the chart should end. (see: User.get_weekly_chart_list)
|
248
|
+
# @see http://www.last.fm/api/show?service=282
|
249
|
+
def get_weekly_track_chart( params )
|
250
|
+
LastFM.get( "user.getWeeklyTrackChart", params )
|
251
|
+
end
|
252
|
+
|
253
|
+
# Shout on a user's shoutbox.
|
254
|
+
#
|
255
|
+
# @option params [String, required] :user user to shout on
|
256
|
+
# @option params [String, required] :message message to post to the shoutbox
|
257
|
+
# @see http://www.last.fm/api/show?service=411
|
258
|
+
def shout( params )
|
259
|
+
LastFM.requires_authentication
|
260
|
+
LastFM.post( "user.shout", params )
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module LastFM
|
2
|
+
module Api
|
3
|
+
class Venue
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# Get a list of upcoming events for a venue.
|
7
|
+
#
|
8
|
+
# @option params [Fixnum, required] :venue the id for the venue to fetch event listings for
|
9
|
+
# @option params [Boolean, optional] :festivalsonly whether only festivals should be returned, or all events
|
10
|
+
# @see http://www.last.fm/api/show?service=394
|
11
|
+
def get_events( params )
|
12
|
+
LastFM.get( "venue.getEvents", params )
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get a paginated list of all the events held at this venue in the past.
|
16
|
+
#
|
17
|
+
# @option params [Fixnum, required] :venue the id for the venue to fetch event listings for
|
18
|
+
# @option params [Boolean, optional] :festivalsonly whether only festivals should be returned, or all events
|
19
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
20
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
21
|
+
# @see http://www.last.fm/api/show?service=395
|
22
|
+
def get_past_events( params )
|
23
|
+
LastFM.get( "venue.getPastEvents", params )
|
24
|
+
end
|
25
|
+
|
26
|
+
# Search for a venue by venue name.
|
27
|
+
#
|
28
|
+
# @option params [String, required] :venue the venue name to search for
|
29
|
+
# @option params [String, optional] :country a country name used to limit results, as defined by ISO 3166-1
|
30
|
+
# @option params [Fixnum, optional] :page the page number to fetch. defaults to first page
|
31
|
+
# @option params [Fixnum, optional] :limit the number of results to fetch per page. defaults to 50
|
32
|
+
# @see http://www.last.fm/api/show?service=396
|
33
|
+
def search( params )
|
34
|
+
LastFM.get( "venue.search", params )
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|