Zend_Service_Audioscrobbler.xml 20 KB

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