Pages

Creating a RSS feed for the Sony PSP

With the recent release of the PSP firmware 2.60 and its support for mp3 media via the RSS reader, I’ve been looking at how to create RSS feeds from my music collection.

Lets have a look at an example of the XML to implement this:

This first section is the header and feed definition, it gives the link to the site, title of the feed, date it was created and an image that is displayed when the feed is shown on your PSP. The image should be no more than 80×80 pixels otherwise it won’t get displayed.

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
<channel>
<title>Iron Maiden/The Number Of The Beast</title>
<link>http://www.yoursite.co.uk/</link>
<description>Iron Maiden/The Number Of The Beast</description>
<language>en-gb</language>
<pubdate>Tue, 13 Dec 2005 19:46:35 +0000</pubdate>
<image>
<url>http://www.yoursite.co.uk/mp3/Iron%20Maiden/The%20Number%20Of%20The%20Beast/Folder.jpg</url>
<title>Iron Maiden/The Number Of The Beast</title>
</image>

<item>
   :
   :
</item>

</channel>
</rss>

The <item> section is were we define the individual track that can be played:
The key tag here is the <enclosure> tag that specified the url of the mp3 file and the media format. I have also include the file length for completeness. The <item> elements are repeated for each file to be made available.

<item>
<title>The Number Of The Beast</title>
<link>http://www.yoursite.co.uk/mp3/</link>
<description>The Number Of The Beast</description>
<pubDate>Mon, 04 Apr 2005 20:51:42 +0100</pubDate>
<enclosure url="http://www.yoursite.co.uk/mp3/Iron%20Maiden/The%20Number%20Of%20The%20Beast/The%20Number%20Of%20The%20Beast.mp3" 
length="4667070" type="audio/mp3"/>
</item>

With a php script based on PhpEdna, I am able to generate a browsable list of all my mp3 files grouped by Artist and Album. For each album there is a link to create the RSS feed. When browsing the list with the PSPs built in web browser I just select the RSS links and the feed is added to the RSS reader. When I go to the RSS reader I then see a list of albums and optional album cover images if they are present. I can then play the mp3 files streamed direct from my Linux server to anywhere I happen to be in the house.

There are still a couple more tweeks to do to the php application before it can be released. Some general features of the application are:

  • Add RSS link to generate the RSS feed
  • Generate well formed XML
  • Does not use the iTunes namespace tags that are used in the PSP sample RSS pages
  • Enable album cover images to be retrieved and re-sized so they work with the PSP
  • URLs generated in the XML should all be properly encoded

Due to the way the RSS feeds work, having the item pubDate element as the file date will cause the track list to be in a date order with the latest date being first. To overcome this and use the order the fiels are retrieved, for example in alphbetic or numeric order you need to set a pubDate element that is identical for all items.

Keep watching for more.

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Comments are closed.