| 1 |
Last.fm Simple Stats
|
| 2 |
--------------------
|
| 3 |
|
| 4 |
This is a simple module which allows you to embed Last.fm statistics for a user
|
| 5 |
inside a node. The module is able to fetch multiple sorts of feeds from
|
| 6 |
Audioscrobbler's web services. Feeds are cached in the database and updated on
|
| 7 |
request or using Drupal cron on a customisable interval. Checking is done
|
| 8 |
intelligently using If-Modified-Since and Expires headers.
|
| 9 |
|
| 10 |
To use the module inside a node, call lastfmsimple_show_feed(). This takes three
|
| 11 |
arguments: a Last.fm user name, a feed name and a number of items to parse/show.
|
| 12 |
|
| 13 |
Examples:
|
| 14 |
* lastfmsimple_show_feed('user', 'recenttracks', 10)
|
| 15 |
* lastfmsimple_show_feed('user2', 'weeklyartistchart', 5)
|
| 16 |
|
| 17 |
The function returns an array of item objects. Object properties are named
|
| 18 |
equally to the feed item's elements.
|
| 19 |
|
| 20 |
A full example:
|
| 21 |
|
| 22 |
<ol>
|
| 23 |
<?php foreach ( lastfmsimple_show_feed('user', 'weeklyartistchart', 5) as $item ): ?>
|
| 24 |
<li>
|
| 25 |
<a href="<?php echo $item->url; ?>"><?php echo $item->name; ?></a>
|
| 26 |
(<?php echo $item->playcount; ?> plays)
|
| 27 |
</li>
|
| 28 |
<?php endforeach; ?>
|
| 29 |
</ol>
|
| 30 |
|
| 31 |
For more information on Audioscrobbler web services, see:
|
| 32 |
http://www.audioscrobbler.net/data/webservices/
|
| 33 |
|
| 34 |
Notes
|
| 35 |
-----
|
| 36 |
|
| 37 |
* This module only parses user statistics.
|
| 38 |
* For now, it has only been tested with recenttracks and weeklyartistchart
|
| 39 |
feeds.
|
| 40 |
|
| 41 |
Author
|
| 42 |
------
|
| 43 |
|
| 44 |
Dietrich Moerman -- http://dmoerman.be
|