1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.service.audioscrobbler">
4 <title>Zend_Service_Audioscrobbler</title>
6 <sect2 id="zend.service.audioscrobbler.introduction">
7 <title>Introduction</title>
10 <classname>Zend_Service_Audioscrobbler</classname> is a simple <acronym>API</acronym>
11 for using the Audioscrobbler REST Web Service. The Audioscrobbler Web Service provides
12 access to its database of Users, Artists, Albums, Tracks, Tags, Groups, and Forums. The
13 methods of the <classname>Zend_Service_Audioscrobbler</classname> class begin with one
14 of these terms. The syntax and namespaces of the Audioscrobbler Web Service are mirrored
15 in <classname>Zend_Service_Audioscrobbler</classname>. For more information about the
16 Audioscrobbler REST Web Service, please visit the <ulink
17 url="http://www.audioscrobbler.net/data/webservices/">Audioscrobbler Web Service
22 <sect2 id="zend.service.audioscrobbler.users">
26 In order to retrieve information for a specific user, the
27 <methodname>setUser()</methodname> method is first used to select the user for which
28 data are to be retrieved. <classname>Zend_Service_Audioscrobbler</classname> provides
29 several methods for retrieving data specific to a single user:
34 <methodname>userGetProfileInformation()</methodname>: Returns a SimpleXML
35 object containing the current user's profile information.
41 <methodname>userGetTopArtists()</methodname>: Returns a SimpleXML object
42 containing a list of the current user's most listened to artists.
48 <methodname>userGetTopAlbums()</methodname>: Returns a SimpleXML object
49 containing a list of the current user's most listened to albums.
55 <methodname>userGetTopTracks()</methodname>: Returns a SimpleXML object
56 containing a list of the current user's most listened to tracks.
62 <methodname>userGetTopTags()</methodname>: Returns a SimpleXML object
63 containing a list of tags most applied by the current user.
69 <methodname>userGetTopTagsForArtist()</methodname>: Requires that an artist
70 be set via <methodname>setArtist()</methodname>. Returns a SimpleXML object
71 containing the tags most applied to the current artist by the current user.
77 <methodname>userGetTopTagsForAlbum()</methodname>: Requires that an album be
78 set via <methodname>setAlbum()</methodname>. Returns a SimpleXML object
79 containing the tags most applied to the current album by the current user.
85 <methodname>userGetTopTagsForTrack()</methodname>: Requires that a track be
86 set via <methodname>setTrack()</methodname>. Returns a SimpleXML object
87 containing the tags most applied to the current track by the current user.
93 <methodname>userGetFriends()</methodname>: Returns a SimpleXML object
94 containing the user names of the current user's friends.
100 <methodname>userGetNeighbours()</methodname>: Returns a SimpleXML object
101 containing the user names of people with similar listening habits to the
108 <methodname>userGetRecentTracks()</methodname>: Returns a SimpleXML object
109 containing the 10 tracks most recently played by the current user.
115 <methodname>userGetRecentBannedTracks()</methodname>: Returns a SimpleXML
116 object containing a list of the 10 tracks most recently banned by the
123 <methodname>userGetRecentLovedTracks()</methodname>: Returns a SimpleXML
124 object containing a list of the 10 tracks most recently loved by the current
131 <methodname>userGetRecentJournals()</methodname>: Returns a SimpleXML object
132 containing a list of the current user's most recent journal entries.
138 <methodname>userGetWeeklyChartList()</methodname>: Returns a SimpleXML
139 object containing a list of weeks for which there exist Weekly Charts for
146 <methodname>userGetRecentWeeklyArtistChart()</methodname>: Returns a
147 SimpleXML object containing the most recent Weekly Artist Chart for the
154 <methodname>userGetRecentWeeklyAlbumChart()</methodname>: Returns a
155 SimpleXML object containing the most recent Weekly Album Chart for the
162 <methodname>userGetRecentWeeklyTrackChart()</methodname>: Returns a
163 SimpleXML object containing the most recent Weekly Track Chart for the
170 <methodname>userGetPreviousWeeklyArtistChart($fromDate,
171 $toDate)</methodname>: Returns a SimpleXML object containing the Weekly
172 Artist Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
173 for the current user.
179 <methodname>userGetPreviousWeeklyAlbumChart($fromDate,
180 $toDate)</methodname>: Returns a SimpleXML object containing the Weekly
181 Album Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
182 for the current user.
188 <methodname>userGetPreviousWeeklyTrackChart($fromDate,
189 $toDate)</methodname>: Returns a SimpleXML object containing the Weekly
190 Track Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
191 for the current user.
197 <example id="zend.service.audioscrobbler.users.example.profile_information">
198 <title>Retrieving User Profile Information</title>
201 In this example, we use the <methodname>setUser()</methodname> and
202 <methodname>userGetProfileInformation()</methodname> methods to retrieve a specific
203 user's profile information:
206 <programlisting language="php"><![CDATA[
207 $as = new Zend_Service_Audioscrobbler();
208 // Set the user whose profile information we want to retrieve
209 $as->setUser('BigDaddy71');
210 // Retrieve BigDaddy71's profile information
211 $profileInfo = $as->userGetProfileInformation();
212 // Display some of it
213 print "Information for $profileInfo->realname "
214 . "can be found at $profileInfo->url";
218 <example id="zend.service.audioscrobbler.users.example.weekly_artist_chart">
219 <title>Retrieving a User's Weekly Artist Chart</title>
221 <programlisting language="php"><![CDATA[
222 $as = new Zend_Service_Audioscrobbler();
223 // Set the user whose profile weekly artist chart we want to retrieve
224 $as->setUser('lo_fye');
225 // Retrieves a list of previous weeks for which there are chart data
226 $weeks = $as->userGetWeeklyChartList();
227 if (count($weeks) < 1) {
228 echo 'No data available';
230 sort($weeks); // Order the list of weeks
232 $as->setFromDate($weeks[0]); // Set the starting date
233 $as->setToDate($weeks[0]); // Set the ending date
235 $previousWeeklyArtists = $as->userGetPreviousWeeklyArtistChart();
237 echo 'Artist Chart For Week Of '
238 . date('Y-m-d h:i:s', $as->from_date)
241 foreach ($previousWeeklyArtists as $artist) {
242 // Display the artists' names with links to their profiles
243 print '<a href="' . $artist->url . '">' . $artist->name . '</a><br />';
249 <sect2 id="zend.service.audioscrobbler.artists">
250 <title>Artists</title>
253 <classname>Zend_Service_Audioscrobbler</classname> provides several methods for
254 retrieving data about a specific artist, specified via the
255 <methodname>setArtist()</methodname> method:
260 <methodname>artistGetRelatedArtists()</methodname>: Returns a SimpleXML
261 object containing a list of Artists similar to the current Artist.
267 <methodname>artistGetTopFans()</methodname>: Returns a SimpleXML object
268 containing a list of Users who listen most to the current Artist.
274 <methodname>artistGetTopTracks()</methodname>: Returns a SimpleXML object
275 containing a list of the current Artist's top-rated Tracks.
281 <methodname>artistGetTopAlbums()</methodname>: Returns a SimpleXML object
282 containing a list of the current Artist's top-rated Albums.
288 <methodname>artistGetTopTags()</methodname>: Returns a SimpleXML object
289 containing a list of the Tags most frequently applied to current Artist.
295 <example id="zend.service.audioscrobbler.artists.example.related_artists">
296 <title>Retrieving Related Artists</title>
298 <programlisting language="php"><![CDATA[
299 $as = new Zend_Service_Audioscrobbler();
300 // Set the artist for whom you would like to retrieve related artists
301 $as->setArtist('LCD Soundsystem');
302 // Retrieve the related artists
303 $relatedArtists = $as->artistGetRelatedArtists();
304 foreach ($relatedArtists as $artist) {
305 // Display the related artists
306 print '<a href="' . $artist->url . '">' . $artist->name . '</a><br />';
312 <sect2 id="zend.service.audioscrobbler.tracks">
313 <title>Tracks</title>
316 <classname>Zend_Service_Audioscrobbler</classname> provides two methods for retrieving
317 data specific to a single track, specified via the <methodname>setTrack()</methodname>
323 <methodname>trackGetTopFans()</methodname>: Returns a SimpleXML object
324 containing a list of Users who listen most to the current Track.
330 <methodname>trackGetTopTags()</methodname>: Returns a SimpleXML object
331 containing a list of the Tags most frequently applied to the current Track.
338 <sect2 id="zend.service.audioscrobbler.tags">
342 <classname>Zend_Service_Audioscrobbler</classname> provides several methods for
343 retrieving data specific to a single tag, specified via the
344 <methodname>setTag()</methodname> method:
349 <methodname>tagGetOverallTopTags()</methodname>: Returns a SimpleXML object
350 containing a list of Tags most frequently used on Audioscrobbler.
356 <methodname>tagGetTopArtists()</methodname>: Returns a SimpleXML object
357 containing a list of Artists to whom the current Tag was most frequently
364 <methodname>tagGetTopAlbums()</methodname>: Returns a SimpleXML object
365 containing a list of Albums to which the current Tag was most frequently
372 <methodname>tagGetTopTracks()</methodname>: Returns a SimpleXML object
373 containing a list of Tracks to which the current Tag was most frequently
381 <sect2 id="zend.service.audioscrobbler.groups">
382 <title>Groups</title>
385 <classname>Zend_Service_Audioscrobbler</classname> provides several methods for
386 retrieving data specific to a single group, specified via the
387 <methodname>setGroup()</methodname> method:
392 <methodname>groupGetRecentJournals()</methodname>: Returns a SimpleXML
393 object containing a list of recent journal posts by Users in the current
400 <methodname>groupGetWeeklyChart()</methodname>: Returns a SimpleXML object
401 containing a list of weeks for which there exist Weekly Charts for the
408 <methodname>groupGetRecentWeeklyArtistChart()</methodname>: Returns a
409 SimpleXML object containing the most recent Weekly Artist Chart for the
416 <methodname>groupGetRecentWeeklyAlbumChart()</methodname>: Returns a
417 SimpleXML object containing the most recent Weekly Album Chart for the
424 <methodname>groupGetRecentWeeklyTrackChart()</methodname>: Returns a
425 SimpleXML object containing the most recent Weekly Track Chart for the
432 <methodname>groupGetPreviousWeeklyArtistChart($fromDate,
433 $toDate)</methodname>: Requires <methodname>setFromDate()</methodname>
434 and <methodname>setToDate()</methodname>. Returns a SimpleXML object
435 containing the Weekly Artist Chart from the current fromDate to the current
436 toDate for the current Group.
442 <methodname>groupGetPreviousWeeklyAlbumChart($fromDate,
443 $toDate)</methodname>: Requires <methodname>setFromDate()</methodname>
444 and <methodname>setToDate()</methodname>. Returns a SimpleXML object
445 containing the Weekly Album Chart from the current fromDate to the current
446 toDate for the current Group.
452 <methodname>groupGetPreviousWeeklyTrackChart($fromDate,
453 $toDate)</methodname>: Returns a SimpleXML object containing the Weekly
454 Track Chart from the current fromDate to the current toDate for the current
462 <sect2 id="zend.service.audioscrobbler.forums">
463 <title>Forums</title>
466 <classname>Zend_Service_Audioscrobbler</classname> provides a method for retrieving data
467 specific to a single forum, specified via the <methodname>setForum()</methodname>
473 <methodname>forumGetRecentPosts()</methodname>: Returns a SimpleXML object
474 containing a list of recent posts in the current forum.