ruairimccomb.com

Projects

rmc_audioscrobbler 26/05/2005

Audio Scrobbler is a service that shows the songs you have been listening to on a webpage – apart from finding other tunes you might like. There are plugins for most of the major media players including iTunes and Winamp and they are free (as in beer).

This plugin takes an audioscrobbler username and a song title amount limit and produces a list of your last played songs.

This is a complete rewrite of bsl_audioscrobbler, by Bradley Law and I also had a look at txp.icio.us by Marshal Potter. Now you can display album covers for each song courtesy of Amazon.

Download

Installation

  • Download and install MagpieRSS. Upload all the files with the extension .inc and the directory extlib to your /textpattern directory.
  • Download and install Amazon Web Services 3.0 SDK (bottom of the page, upload AmazonSearch.php to your /textpattern directory).
  • You’ll also need the NuSOAP library (you’ll be downloading from CVS, upload nusoap.php to your /textpattern directory).
  • Install and activate rmc_audioscrobbler

Usage

Attributes
  • username: your Audio Scrobbler username (default – ruairimccomb)
  • form: the Textpattern form used for formatting (default – audioscrobbler)
  • limit: the amount of last played songs to display (default: 10)
  • imagesize: album image width and height in pixels (_default: small : 50px; medium : 150px; large : 300px _)
  • defaultimage: url of the image to use as the cover when no cover is found
  • usecache : set to false to not cache the response from Audio Scrobbler (default – true)
  • cacheage : the age of a cache file in minutes before it is considered obsolete and an attempt to refresh the cache is made (default – 5)
  • cachepath : the path to a folder that you want to keep the cache file in. You may need to change the permissions on that folder to something like 777 (start there and work back). The folder must exist. (default – tries to use the textpattern temp dir)
  • preventcaching : set to true to prevent caching of the response from Audio Srobbler (default – false).
  • notworkingmessage : the message to display if the cache is not being used and the audioscrobbler site is not avaliable (default – rdf feed not avaliable and cache not present)
  • notworkingform : the form to display if the cache is not being used and the audioscrobbler site is not avaliable (default – none)
  • notlisteningmessage : the message to display if the audioscrobbler feed does not contain any recenly played tracks (default – not listening to music)
  • notlisteningform : the form to display if the cache is not being used and the audioscrobbler site is not avaliable (default – none)
  • amazonid : you amazon associates ID. This will be used for building links to amazon.
  • wrap :
  • break :
Example tag
<txp:rmc_audioscrobbler limit="5" 
	

username="ruairimccomb"

form="audioscrobbler"

cachepath="./as_cache"

defaultimage="/images/no-cover.gif" />

Will output a list of the five most recently played songs by the user ruairimccomb. The form audioscrobbler will be used to output each song. If no image can be found for a song, /images/no-cover.gif will be used. Caching is turned on and will save the cache file in the ./as_cache directory, which is relative to the index.php file in the root of your txp site (not the index.php in your textpattern directory).

Form tags

These are the tag you can use in your form:

  • <txp:as_link> : A link to the song on Audio Scrobbler.
  • <txp:am_link> : A link to the song on Amazon.
  • <txp:author /> : The name of the author of the song.
  • <txp:title /> : The title of the song.
  • <txp:album /> : The name of the album of the song.
  • <txp:album_img_small /> : Small album cover image.
  • <txp:album_img_medium /> : Medium album cover image.
  • <txp:album_img_large /> : Large album cover image.
Example form
<li><txp:as_link><txp:album_img_small /></txp:as_link></li>

Known Problems

This plugin will not work in PHP5. If you’re hosted on TextDrive you can switch to PHP4 by adding the following to your .htaccess file:

AddType application/x-httpd-fastphp4 .php
Action application/x-httpd-fastphp4 /php-fastcgi/php4-fcgi

Changelog

0.2
  • added the attributes notlisteningform and notworkingform