1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.service.audioscrobbler">
<title>Zend_Service_Audioscrobbler</title>
<sect2 id="zend.service.audioscrobbler.introduction">
<title>Introduction</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> is a simple <acronym>API</acronym>
for using the Audioscrobbler REST Web Service. The Audioscrobbler Web Service provides
access to its database of Users, Artists, Albums, Tracks, Tags, Groups, and Forums. The
methods of the <classname>Zend_Service_Audioscrobbler</classname> class begin with one
of these terms. The syntax and namespaces of the Audioscrobbler Web Service are mirrored
in <classname>Zend_Service_Audioscrobbler</classname>. For more information about the
Audioscrobbler REST Web Service, please visit the <ulink
url="http://www.audioscrobbler.net/data/webservices/">Audioscrobbler Web Service
site</ulink>.
</para>
</sect2>
<sect2 id="zend.service.audioscrobbler.users">
<title>Users</title>
<para>
In order to retrieve information for a specific user, the
<methodname>setUser()</methodname> method is first used to select the user for which
data are to be retrieved. <classname>Zend_Service_Audioscrobbler</classname> provides
several methods for retrieving data specific to a single user:
<itemizedlist>
<listitem>
<para>
<methodname>userGetProfileInformation()</methodname>: Returns a SimpleXML
object containing the current user's profile information.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopArtists()</methodname>: Returns a SimpleXML object
containing a list of the current user's most listened to artists.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopAlbums()</methodname>: Returns a SimpleXML object
containing a list of the current user's most listened to albums.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopTracks()</methodname>: Returns a SimpleXML object
containing a list of the current user's most listened to tracks.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopTags()</methodname>: Returns a SimpleXML object
containing a list of tags most applied by the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopTagsForArtist()</methodname>: Requires that an artist
be set via <methodname>setArtist()</methodname>. Returns a SimpleXML object
containing the tags most applied to the current artist by the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopTagsForAlbum()</methodname>: Requires that an album be
set via <methodname>setAlbum()</methodname>. Returns a SimpleXML object
containing the tags most applied to the current album by the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetTopTagsForTrack()</methodname>: Requires that a track be
set via <methodname>setTrack()</methodname>. Returns a SimpleXML object
containing the tags most applied to the current track by the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetFriends()</methodname>: Returns a SimpleXML object
containing the user names of the current user's friends.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetNeighbours()</methodname>: Returns a SimpleXML object
containing the user names of people with similar listening habits to the
current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentTracks()</methodname>: Returns a SimpleXML object
containing the 10 tracks most recently played by the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentBannedTracks()</methodname>: Returns a SimpleXML
object containing a list of the 10 tracks most recently banned by the
current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentLovedTracks()</methodname>: Returns a SimpleXML
object containing a list of the 10 tracks most recently loved by the current
user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentJournals()</methodname>: Returns a SimpleXML object
containing a list of the current user's most recent journal entries.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetWeeklyChartList()</methodname>: Returns a SimpleXML
object containing a list of weeks for which there exist Weekly Charts for
the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentWeeklyArtistChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Artist Chart for the
current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentWeeklyAlbumChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Album Chart for the
current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetRecentWeeklyTrackChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Track Chart for the
current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetPreviousWeeklyArtistChart($fromDate,
$toDate)</methodname>: Returns a SimpleXML object containing the Weekly
Artist Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
for the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetPreviousWeeklyAlbumChart($fromDate,
$toDate)</methodname>: Returns a SimpleXML object containing the Weekly
Album Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
for the current user.
</para>
</listitem>
<listitem>
<para>
<methodname>userGetPreviousWeeklyTrackChart($fromDate,
$toDate)</methodname>: Returns a SimpleXML object containing the Weekly
Track Chart from <varname>$fromDate</varname> to <varname>$toDate</varname>
for the current user.
</para>
</listitem>
</itemizedlist>
</para>
<example id="zend.service.audioscrobbler.users.example.profile_information">
<title>Retrieving User Profile Information</title>
<para>
In this example, we use the <methodname>setUser()</methodname> and
<methodname>userGetProfileInformation()</methodname> methods to retrieve a specific
user's profile information:
</para>
<programlisting language="php"><![CDATA[
$as = new Zend_Service_Audioscrobbler();
// Set the user whose profile information we want to retrieve
$as->setUser('BigDaddy71');
// Retrieve BigDaddy71's profile information
$profileInfo = $as->userGetProfileInformation();
// Display some of it
print "Information for $profileInfo->realname "
. "can be found at $profileInfo->url";
]]></programlisting>
</example>
<example id="zend.service.audioscrobbler.users.example.weekly_artist_chart">
<title>Retrieving a User's Weekly Artist Chart</title>
<programlisting language="php"><![CDATA[
$as = new Zend_Service_Audioscrobbler();
// Set the user whose profile weekly artist chart we want to retrieve
$as->setUser('lo_fye');
// Retrieves a list of previous weeks for which there are chart data
$weeks = $as->userGetWeeklyChartList();
if (count($weeks) < 1) {
echo 'No data available';
}
sort($weeks); // Order the list of weeks
$as->setFromDate($weeks[0]); // Set the starting date
$as->setToDate($weeks[0]); // Set the ending date
$previousWeeklyArtists = $as->userGetPreviousWeeklyArtistChart();
echo 'Artist Chart For Week Of '
. date('Y-m-d h:i:s', $as->from_date)
. '<br />';
foreach ($previousWeeklyArtists as $artist) {
// Display the artists' names with links to their profiles
print '<a href="' . $artist->url . '">' . $artist->name . '</a><br />';
}
]]></programlisting>
</example>
</sect2>
<sect2 id="zend.service.audioscrobbler.artists">
<title>Artists</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> provides several methods for
retrieving data about a specific artist, specified via the
<methodname>setArtist()</methodname> method:
<itemizedlist>
<listitem>
<para>
<methodname>artistGetRelatedArtists()</methodname>: Returns a SimpleXML
object containing a list of Artists similar to the current Artist.
</para>
</listitem>
<listitem>
<para>
<methodname>artistGetTopFans()</methodname>: Returns a SimpleXML object
containing a list of Users who listen most to the current Artist.
</para>
</listitem>
<listitem>
<para>
<methodname>artistGetTopTracks()</methodname>: Returns a SimpleXML object
containing a list of the current Artist's top-rated Tracks.
</para>
</listitem>
<listitem>
<para>
<methodname>artistGetTopAlbums()</methodname>: Returns a SimpleXML object
containing a list of the current Artist's top-rated Albums.
</para>
</listitem>
<listitem>
<para>
<methodname>artistGetTopTags()</methodname>: Returns a SimpleXML object
containing a list of the Tags most frequently applied to current Artist.
</para>
</listitem>
</itemizedlist>
</para>
<example id="zend.service.audioscrobbler.artists.example.related_artists">
<title>Retrieving Related Artists</title>
<programlisting language="php"><![CDATA[
$as = new Zend_Service_Audioscrobbler();
// Set the artist for whom you would like to retrieve related artists
$as->setArtist('LCD Soundsystem');
// Retrieve the related artists
$relatedArtists = $as->artistGetRelatedArtists();
foreach ($relatedArtists as $artist) {
// Display the related artists
print '<a href="' . $artist->url . '">' . $artist->name . '</a><br />';
}
]]></programlisting>
</example>
</sect2>
<sect2 id="zend.service.audioscrobbler.tracks">
<title>Tracks</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> provides two methods for retrieving
data specific to a single track, specified via the <methodname>setTrack()</methodname>
method:
<itemizedlist>
<listitem>
<para>
<methodname>trackGetTopFans()</methodname>: Returns a SimpleXML object
containing a list of Users who listen most to the current Track.
</para>
</listitem>
<listitem>
<para>
<methodname>trackGetTopTags()</methodname>: Returns a SimpleXML object
containing a list of the Tags most frequently applied to the current Track.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="zend.service.audioscrobbler.tags">
<title>Tags</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> provides several methods for
retrieving data specific to a single tag, specified via the
<methodname>setTag()</methodname> method:
<itemizedlist>
<listitem>
<para>
<methodname>tagGetOverallTopTags()</methodname>: Returns a SimpleXML object
containing a list of Tags most frequently used on Audioscrobbler.
</para>
</listitem>
<listitem>
<para>
<methodname>tagGetTopArtists()</methodname>: Returns a SimpleXML object
containing a list of Artists to whom the current Tag was most frequently
applied.
</para>
</listitem>
<listitem>
<para>
<methodname>tagGetTopAlbums()</methodname>: Returns a SimpleXML object
containing a list of Albums to which the current Tag was most frequently
applied.
</para>
</listitem>
<listitem>
<para>
<methodname>tagGetTopTracks()</methodname>: Returns a SimpleXML object
containing a list of Tracks to which the current Tag was most frequently
applied.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="zend.service.audioscrobbler.groups">
<title>Groups</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> provides several methods for
retrieving data specific to a single group, specified via the
<methodname>setGroup()</methodname> method:
<itemizedlist>
<listitem>
<para>
<methodname>groupGetRecentJournals()</methodname>: Returns a SimpleXML
object containing a list of recent journal posts by Users in the current
Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetWeeklyChart()</methodname>: Returns a SimpleXML object
containing a list of weeks for which there exist Weekly Charts for the
current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetRecentWeeklyArtistChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Artist Chart for the
current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetRecentWeeklyAlbumChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Album Chart for the
current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetRecentWeeklyTrackChart()</methodname>: Returns a
SimpleXML object containing the most recent Weekly Track Chart for the
current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetPreviousWeeklyArtistChart($fromDate,
$toDate)</methodname>: Requires <methodname>setFromDate()</methodname>
and <methodname>setToDate()</methodname>. Returns a SimpleXML object
containing the Weekly Artist Chart from the current fromDate to the current
toDate for the current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetPreviousWeeklyAlbumChart($fromDate,
$toDate)</methodname>: Requires <methodname>setFromDate()</methodname>
and <methodname>setToDate()</methodname>. Returns a SimpleXML object
containing the Weekly Album Chart from the current fromDate to the current
toDate for the current Group.
</para>
</listitem>
<listitem>
<para>
<methodname>groupGetPreviousWeeklyTrackChart($fromDate,
$toDate)</methodname>: Returns a SimpleXML object containing the Weekly
Track Chart from the current fromDate to the current toDate for the current
Group.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
<sect2 id="zend.service.audioscrobbler.forums">
<title>Forums</title>
<para>
<classname>Zend_Service_Audioscrobbler</classname> provides a method for retrieving data
specific to a single forum, specified via the <methodname>setForum()</methodname>
method:
<itemizedlist>
<listitem>
<para>
<methodname>forumGetRecentPosts()</methodname>: Returns a SimpleXML object
containing a list of recent posts in the current forum.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
|