PSP MP3

This document may be distributed freely if unchanged.

If anything in this tutorial is incorrect then let me know.

Contents

Prologue

Starting with firmware 2.6, the PSP (PlayStation Portable) has the ability to stream and play music over a network. It does this by means of RSS feeds. Such an RSS feed contains links to music files on a web server, which are played by the PSP as they are being downloaded.

Music files from RSS feeds are treated the same way music on a memory stick is treated, so you can shuffle, forward, rewind, etc. Also, you can save the files from the web server to your memory stick.

Preparation and requirements

This tutorial is meant for people who want to stream music to their PSP from their web server using WiFi. You will need the following: This tutorial assumes you have all this working, and will only deal with setting up scripts etc. to make streaming music to your PSP possible. This tutorial will assume the following directories exist:

/home/user/scripts/
This directory will contain the file caching script.
/shares/
This directory will contain the music to be streamed.
/var/www/domain.com/
This directory is the DocumentRoot, i.e., files in this directory are accessible through http://www.domain.com/. It contains the search/rss script and some icons. It also has a symbolic link to /shares/, so music files are accessible through the web server.

Just search and replace through the files mentioned below to use different directories.

Scripts

In order to make streaming music as easy as possible, I have written a few scripts and files:

icon
This directory contains images for RSS feeds. They show up in the PSP RSS menu for easier navigation.
.htaccess
This file makes sure only people from 192.168.*.* (local network) can access your music.
crontab.txt
This file is read by the cron daemon to refresh the file cache daily.
music.xml.php
This file is an example of a manual RSS feed.
shares.php
This script presents file information to the user. It shows directories and files you have shared, allows you to search for files and presents RSS feeds to the PSP.
shares.pl
This script creates a file cache of your shares for faster searching.

The scripts can be downloaded here: PSP MP3 streaming scripts.

Setting up the file cache

The first thing to do is setting up a file cache. This cache will contain information on your shares directory and the files and directories in it. This will allow for faster searching later on.

Copy shares.pl to /home/user/scripts/
cp shares.pl /home/user/scripts/
Run it and redirect the output to DocumentRoot
/home/user/scripts/shares.pl > /var/www/domain.com/shares.data.php

Notice that the output of this program is a large (depending on the number of music files you want accessible) PHP array.

Automatically refreshing the cache

When you have new music, you will of course want this music to be accessible as well. In order for the cache to remain up-to-date, you need to run it, say, daily:

Edit your crontab
crontab -e
Paste the line from crontab.txt in the editor
0 3 * * * /home/user/scripts/shares.pl > /var/www/domain.com/shares.data.php

This will update the cache daily at 3:00 AM. Next, we want to use the cache we have just generated. This is where shares.php comes in:

Copy shares.php to DocumentRoot
cp shares.php /var/www/domain.com/

Next, open this script in your browser, i.e., go to http://www.domain.com/shares.php.

If all went well, you will see a nice overview of your directories and files. If a directory contains MP3 files, it will also show an RSS button. At the bottom you see a search field. Only simple terms (no spaces) are supported.

Finding icons

Per RSS feed, the PSP can display an icon. This allows for a clearer overview of your feeds. The shares.php script mentioned above will look for a suitable icon based on the directory or search result. To add your own icons, look for an image you like on e.g. Google Image Search, crop/resize it to 80x80 pixels and give it a suitable name (usually the name of the directory containing the music files).

Loading RSS feeds in PSP

Now, turn on your PSP. Start the internet browser and go to http://www.domain.com/shares.php.

Go to any directory containing MP3 files and you'll notice the RSS button at the top. When you click it, the PSP will download the RSS feed and, when found, show the corresponding icon. Say "Yes" to add this channel.

Exit the browser and go to the RSS menu. You will see your feed has been added here. Press triangle and then choose Play to start playing music, or choose Save to save the music to your memory stick.

Note that the PSP only supports a maximum of 100 items per feed. More items will simply be ignored. This is where manual feeds can come in handy.

Creating manual RSS feeds

If the search/rss script from above cannot give you the feeds you like, you can create manual RSS feeds. An example manual feed can be found in music.xml.php.

In this feed, put all the files you want to listen to in the $files array at the top. You can also change the feed information in the first XML block and change e.g. the title and the icon shown.

Because the PSP only supports a maximum of 100 items per feed, the feed will choose a random block of 100 items from the $files array. This happens every time the feed is downloaded, i.e., each time the WiFi connection is broken.

Epilogue

If all went well, you're now able to enjoy your music without filling up your memory stick. Enjoy :)