arc_lastfm (early beta release)

This plugin is very much in the experimental stage at the moment, but I am releasing what has been put together so far as a beta version of the plugin. The aim is to have a single plugin that enables you to tap into the rich resource of information on the excellent social music website last.fm using its API.

In its current state it solely outputs a user’s recent track listing from last.fm. It uses my last.fm class, a library of functions to access the various methods available through the API. It should be apparent from the arc_lastfm class that there is a great deal of expansion planned for this plugin.

arc_lastfm requires PHP5+ as it makes uses of SimpleXML and PHP5’s improved object orientation.

Installation

To install go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin.

Syntax

<txp:arc_lastfm api=“your_API_key” user=“lastfm_username” />

Usage

In order to use the last.fm API you will need to get an API key from last.fm. Once you’ve got your key you will need to set the api attribute with it when you use the plugin.

Attribute Description Default Example
api Your API key (required) unset
user last.fm user name unset user=“monkey-ninja”
label Label for the top of the list no label label=“Recent tracks”
labeltag Independent wraptag for label unset labeltag=“h3”
break HTML tag (without brackets), or string, used to separate the tracks li break=“br”
wraptag HTML tag to be used as the wraptag, without brackets unset wraptag=“ul”
class CSS class attribute for wraptag arc_lastfm class=“lastfm”
Caching

In order to prevent excessive repeatitive calls to the last.fm website it is recommended to cache results. Your last.fm account may be suspended if you continuously make several calls per second. By default, arc_lastfm caches for 5 minute intervals.

Attribute Description Default Example
caching ‘1’ to cache feed, ‘0’ to turn caching off (not recommended) 1 caching=“1”
cache_dir Absolute path to the cache directory (must be writable)
cache_time Time in minutes that the cache files are stored before being refreshed 5 cache_time=30

Future plans

All will be revealed in good time!

The Details