Simple RSS, Wireless Streaming Audio and Images, and JPEG Books
from PDF for
the
PSP
This page provides some information on my recent acquisition and
experience with use of a Sony PSP.
You'll also get a short description of how to quickly create JPEG books
from PDF files, then set up simple RSS feeds
of your .mp3 albums so you can listen to music wirelessly on your PSP.
A shell script listing is included to get you started.
I've been a big fan of compact appliance computing for quite some time,
but like other Linux fans I'm afraid to yet again experience the
disappointment of an open-source software device that fails to live up
to expectations - for example, the Agenda PDA, the vaporware Yopy, and myriad others.
I really liked my Zaurus
5500 - a steal at $162 purchased online and shipped from the Home
Shopping Network - until some asshats from Florida Van Lines ripped it
off during a 2004 house move, along with my Yaesu
VR120D wideband
receiver.
Some really neat pads and PDAs, such as the updated Nokia 770 and
Pepperpad,
are on the market right now. I'm glad to see continued
exploration by hardware manufacturers into Linux and BSD-based devices.
But alas, the cost of these shiny trinkets is prohibitive, especially
since i'm on my second retirement and can't write off new geek toys as
a business expense.
After doing a bit of research, I ran across the Sony PSP after the wife
unit suckered me into getting her a PS2-based Dance
Dance Revolution
outfit for Xmas, that happiest, highest, and holiest of Capitalist
holidays. I found the PS2 version of Pinball Hall of Fame for less than
$5 online and was hooked. Kudos to the programmer, btw, because
gameplay on one of the tables is exactly as I remember it. That's a
remarkable achievement in software programming! Since the same game is
available for the PSP, that clinched the deal - it's the only PSP game
I will ever purchase and play.
The PSP
The Sony Portable Play Station, which can be purchased new for $169 or
used for around $130, offers a lot more value for the money than is
initially obvious. IMHO, this little toy, albeit with some not-so-fatal
flaws, provides a pretty good bang for the buck depending on how it is
used.
Here's what makes the PSP different from other consumer gaming
consoles: the PSP easily integrates into
your existing LAN. Plus, feature-for-feature it beats the pants off of
the stupid DRM'd Sony
Portable Reader System PRS-500, which sells for US350!
The initial hooplah following the PSP's 2005 introduction seems to have
died down. Indeed, the bought-and-paid-for cabal of so-called gaming
experts, self-styled industry pundits, and hack tech-journalists now
bemoan the
PSP's lower 2006 sales figures and less than "Nintendo's DS
millions of units sold" as indicating a lack of success for the
PSP's or a failure of engineering excellence. My personal opinion is
that these people are idiots, and that the PSP is being mis-marketed or
not fully targeted at the right
audiences.
Consider what you get:
- handheld color PDA/tablet (no touch screen though)
- 480x272 pixel million-color display
- stereo sound
- replaceable LiIon battery (larger capacity available)
- built-in 802.11b wireless
- USB port supporting cross-platform file transfer (Linux, etc.)
- optical media reader
- memory stick slot (Duo Pro), currently supporting up to 8GB
- hundreds of games, many legacy PS1 games, others in emulation
- active hacker/cracker development (firmware hacking)
- cheap physical accessories
- built-in photo (slide show) viewer, wallpaper, etc.
- built-in Web browser (w/bookmarks and other settings)
- built-in video player (supporting multiple codecs)
- built-in music player
- free open-source utilities for ripping video, audio
- RSS support (the reason for this Web page)
The downside:
- insipid Sony marketing and DRM
- non-open-sourced specs - with a few exceptions; also, some NetBSD and
open-source libs are used in the system (much in the same way as GNU
GPL'd software is inside Sony's WEGA
HDTV DLP units)
- firmware upgrades aimed at defeating crackers, not offering features
- lack of accessory keyboard
- a built-in IrDA port that doesn't seem to be used (WTF?)
- the world's worst GUI keyboard
- as yet un-introduced GPS and Camera accessories for U.S. users (more
to come on this as i've ordered the camera - w00t!)
Some Workarounds
The lack of a keyboard and the sucky built-in GUI PSP keyboard can seem
like a serious limitation. Fortunately there is a workaround for
entering browser URLs: a number of sites offer a Javascript keyboard
that will use the PSP's built-in Flash (6) support to launch a new
session remotely. Many of these keyboards offer shortcut keys (such as
http://, www., .com, etc.) You can try this out yourself at:
http://pspeeps.com
Another problem is the diminutive display. The built-in browser offers
the ability to change to large, normal, or small font sizes, along with
normal, fit to width, or 'smart-fit' Web page rendering. But sometimes
smaller is better: For example, you can use Google's PDA page to make the task of
searching the Web a bit easier.
If you need a calculator on your PSP, you can use an on-line
version, or like the keyboard code above, simply copy the
HTML/javascript code to your PSP/COMMON directory on your Pro Duo card,
then create a bookmark to the keyboard and calculator in the PSP
browser.
NOTE: My home and
other pages have been PDA browser friendly for years now!
Although you may think that more storage is better, you really don't
need more storage IMO. Read the next section to see why you may pass on
purchasing an expensive ($200 for 8GB) Pro Duo Memory Stick right now
(although
prices are dropping - currently about US$60 for 4GB sticks).
Recommended
BTW, a
highly recommended accessory is Logitech's CHICOM-made PlayGear
Pocket™:

This case is made of clear polycarbonate and while closed allows access
to essential PSP controls for listening to audio. Fold the case top
back to make a stand for watching movies. You can also slip a photo,
sticker, ID card or other silly sentimental items between the top
and inner rubber insulation. Another good accessory is the Logitech
Visor, a clip-on polycarbonate screen cover that provides access to the
UMD optical drive and all controls (about US$9, IIRC).
How I use my PSP
My PSP is used as a home library access device. It follows me around
the house, on the kitchen table or counter, end table in the living
room, armchair in the family room, or bedside stand in the bedroom.
I
use my PSP to:
Watch Delayed TV, Cartoon
collections, or Ripped movies
I use the
following steps under Mac OS X to rip video DVDs into a format best
suited for the PSP:
1. Rip the DVD onto my iBook's drive using MacTheRipper.
2. Rip the resulting folder into component (or single) titles using instantHandBrake,
although ffmpeg would work
as well.
3. Either download the video (which needs to be named M4V1000X.MP4
under firmware 2.71) wirelessly to the PSP onto the Pro Duo memory
stick, or transfer via USB from the
desktop, which works under any operating system with no special
software required.
"Up yours!"
TV networks, RIAA, and MPAA - I own any content I purchase!
BTW, there are thousands of free cartoons, TV shows, and movies for the
PSP available through the Moving Internet Archive.
Click through the links to select your movie, then download the 256Kb
MPEG4 version - it will work perfectly on your PSP!
You can also get PSP-formatted videos through Google Video. Unfortunately Google
has recently polluted its
video database with all the YouTube crap, so your searches have to be
selective. Use a search term such as 'public domain movie,' then click
a Google video link. In the video's page, quickly click the Download
drop-down menu for the video type to select 'Video iPod/Sony PSP,' not
'WinBlows/Mac.'
Create and Use an Enormous
Home-based
On-line Library
I can easily read any one of 10,000 books
in my Gutenberg
library
by downloading, mounting, and copying a Gutenberg CD DVD into my
Sites directory. You'll need to populate your own Apache site if you
use GNU/Linux or another decent operating system such as OpenBSD.
View Slide Shows of Digital Photos and
Read JPEG Books made from PDFs
The PSP's internal viewer
supports a variety of image formats, and any picture can be quickly
used as a wallpaper. Alternatively, you can use a simple
javascript slide show script on your home Apache server to display
larger collections of images.
The PSP's photo viewer interface can also be used to read books viewed
as a series of JPEG files. Here are the steps I use to create books
from HTML or text:
Step-by-Step for Linux
1. Open the document using OpenOffice.org. Set page format
(Format->Page-Page tab) for Legal size, Portrait orientation, and
0.25 margins. I also use a header with a page number (so each resulting
JPEG has a page number in upper right corner). I'm going blind,
so I need to use at least 30 point type for the ebook's text - which
increases the page/JPEG count
and size of the resulting ebook.
2. Print the doc to a PDF file (Export as PDF from the File menu).
3. Run the PDF file through the following script (which I have named
pdf2jpeg), which requires ImageMagick and
the pdftk software packages. For example:
$ pdf2jpeg
mybook.pdf
Here's the script:
#!/bin/sh
#
# pdf2jpeg - convert a pdf doc to individual jpeg images for
# viewing on a Sony PSP - IOW, an ebook creator...
#
# v0.1 by bravo_bravo_alpha_lima_lima
# alpha_tango
# tango_uniform_xray_delta_oscar_tango_oscar_romeo_golf
#
# requires: ImageMagick and pdftk software packages
# (adjust jpeg quality via convert's density option)
#
# bugs: no error checking
#
# create directory using pdf's filename
mkdir $1_book
cd $1_book
# split pdf into individual pdf pages
pdftk ../$1 burst
# convert each pdf to jpeg and rotate to landscape for psp
for file in *pdf
do
convert -density 150x150 -trim -rotate 90 $file $file.jpeg
rm -f $file
done
# remove "pdf" from filenames
for file in *jpeg
do
mv $file ${file%pdf.*}jpeg
done
# remove pdftk's burst report
rm -f doc_data.txt
The result will be a directory of the PDF's filename ending in _book.
The directory will contain a series of JPEG images representing
individual pages. Then simply copy the folder to your PSP under the
/Picture directory. You can adjust the image quality by changing the
convert command's density option (150x150 in the above script).
Step-by-Step for Mac OS X
You can use the previous script under OS X, or if you prefer a nice
GUI, use the following:
1. Copy the desired text into the clipboard
2. Paste the text into an AppleWorks document with the following
settings: Page Setup for legal-sized paper, portrait at 125 percent,
document margins set for 0.25in top/bottom/left/right, font set to
Helvetica or Times at 20 point. HTML docs and text copied and pasted
from a browser format just fine. Other types of text with line breaks
may need to be reformatted, a task easily accomplished using the
dos2unix command, sed, or two or three global search and replaces in
your word processor.
3. Print the document to a PDF file.
4. Process PDF file through PDF2PSP
using the following settings: High resolution, Landscape, best
image quality
The result will be a folder (directory) with the name of your document,
and a series of numbered JPEG files in the folder corresponding to the
pages of your book. Simple copy the folder in the Picture directory on
your PSP.
Using either approach you can then read your book in portrait mode w/no
resizing,
flipping back and forth through pages using the PSP's right/left
shoulder buttons.
Listen to Music via RSS and
Streaming Audio
Ripping audio CDs should be old hat for all users by now,
but to save memory stick storage and centralize my collection, i stream
the audio to my PSP by using RSS... here are the steps I use to set up
the system, followed by the script i use:
1. Setting up and running a personal Web page
using Apache on OS X is as simple as two or three mouse clicks; go to
System Preference, click on Sharing, Services, and Personal Web
Sharing. Populate your $HOME/Sites directory with files, then just
browse to:
http://localhost/~your_username
Or on your home LAN to:
http://your_IP_address/~your_username.
If you run GNU/Linux, use your distro's system service utility to
control httpd service, then populate either a custom site or default
file system location with your content. On my system, I copied my
ripped movies, free books, and audio to the Sites directory, keeping
things organized and simple:
books/
keyboard/
movies/
music/
photos/
Don't forget to first check to make sure that your system works
by browsing to the IP address from your PSP.
2. Next, I created a shell script to parse a directory of .mp3 files
and create an .xml file to serve the files to my remote PSP's RSS
aggregator (a stupid technical term for a piece of software that
displays available streams of data, such as text, HTML, video, or in
the case here, digital audio or .mp3 files). The shell script was
developed on an Apple OS X iBook G4, running the 10.3.9 operating
system. Copy or paste the text into an editor with line-wrap disabled,
then use the chmod command to make it executable. I keep it in my
$HOME/bin directory, which is in my PATH.
3. Next, I navigated to the directory above my music directories and
ran
the shell script with the name of the desired RSS feed (i usually use
the artist's name), genre of music (such as jazz or rock), and the name
of the directory containing the mp3 files.
For example:
- Change directory to my music directory:
$ cd
/Users/bball/Sites/psp/music/
- Let's see what I have for this search:
$ ls bo*
bob_james_david_sanborn:
double_vision
boney_james:
seduction
- Aha! Two of my favorite albums. Let's create an .xml RSS playlist
for the Seduction album:
$ mitunes
boney_james jazz boney_james/seduction
The result will be an .xml file named 0seduction.xml under the
/Users/bball/Sites/psp/music directory - I programmed the script to
place a zero at the beginning of the resulting .xml file so that the
playlist feeds show up at the top of browser listing (makes 'em easier
to find and scroll through). Modify the script to place the resulting
.xml file anywhere on your Web site - perhaps under a directory named
Playlists?
4. To use the RSS feeds, load up the PSP browser, navigate to the
directory listing, and click on an .xml file. The PSP will then show a
dialog asking if you want to save the RSS feed. Click OK, then go back
and exit the
browser. Next, load up the RSS client, connect, scroll through the list
of
feeds, and you'll see a new feed (in this case) with the name
"boney_james." Click on the feed, and the list of .mp3s from the album
will show up. You can then play your tunes wirelessly on your PSP from
your server - no need for lots of internal storage and you can save the
money you would have spent for a larger memory stick!
If you examine the script you'll soon see that there's nothing
special there - I'm sure you could improve the script (such as to
provide
recursion through all
directories, selective playlists, etc.). All the script does is set a
header, loop though the
specified directory of mp3s, then create an item-by-item feed for each
song.
Note some additional technical info in the script (which may
change with firmware updates from Sony).
Here's the script (or you can get it here):
#!/bin/sh
# miTunes - A simple rss .xml mp3 playlist generator.
#
# Originally intended for use with the Sony PSP and Mac OS X.
#
# miTunes creates a named playlist of a specified directory containing
# an album's mp3 files.
#
# Version 0.4
#
# Usage: mitunes name_of_artist genre pathname_to_mp3_files
#
# Example: mitunes dave_koz jazz music/dave_koz/off_the_beaten_path
# or: mitunes dave_koz jazz musi*/dave*oz/off*
#
# These examples will create an .xml playlist named "0off_the_beaten_path.xml" in
# the current directory. The playlist will be suitable for RSS on the
# Sony PSP.
#
# Bugs: no error checking
#
# NOTE: if using Mac OS X, uncomment the 822-date line below;
# under Linux, use the date command with the -rfc option, else
# RSS feed on the Sony PSP will fail. RSS .xml for the PSP
# must use RFC822 or W3C date/time formatted strings.
#
# In this version you must also edit the embedded URLs for your setup.
# You should be able to see where to make the edits, right?
# :-)
#
# TODO: Sony's specs provide for image, music, and video streaming to the
# the PSP handheld, so this script could be expanded to support creation
# of other streams, and the addition of many features, such as thumbnail
# images. You can find examples through:
#
# http://www.sonymediasoftware.com/support/default.asp
#
# In particular, look for the document "PSP Media Manager Specifications
# for Feed Providers and Feed Publishers." Some examples may be found
# at:
#
# http://www.mediasoftwareapps.com/feeds/FeedList.opml
# http://www.mediasoftwareapps.com/feeds/PhotoExample.asp
# http://www.mediasoftwareapps.com/feeds/MusicExample.asp
# http://www.mediasoftwareapps.com/feeds/H263VideoExample.asp
# http://www.mediasoftwareapps.com/feeds/H264VideoExample.asp
#
# Note that video streaming apparently isn't supported by 3.03 or lower
# PSP firmware! Perhaps Sony is simply using the PSP as a test ground
# for the PS3's on-line battlefield against Xbox?
#
# Create playlist .xml header
echo "
<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>$1</title>
<link>http://192.168.1.102/~bball/psp/music/</link>
<description>user-generated psp mp3 playlist</description>
<language>en-us</language>
<copyright>2007</copyright>
<lastBuildDate>Mon, 29 Jan 2007 06:20:09 GMT</lastBuildDate>
<generator>linux_author</generator> <webMaster>sue_mee@yoohoo.com</webMaster>
" > 0$1.xml
# loop through designated directory
for file in $3/*mp3
do
echo " <item>
<title>$file</title>
<description>$2</description>
<pubDate>$(822-date)</pubDate>
# <pubDate>$(date -rfc)</pubDate>
<enclosure url=\"http://192.168.1.102/~bball/psp/music/$file\" length=\"\" type=\"audio/mpeg\"/>
</item>
" >>0$1.xml
done
#end of playlist.xml
echo "
</channel>
</rss>
" >>0$1.xml
How to Use RSS to Serve Images to Your PSP
You can also use this same approach to quickly build an RSS feed of a
series of photos. Alas, I have been unable (as yet) to implement the
(vaguely) documented use of a .zip file to serve a series of images,
but the following script will create an .xml RSS feed of a directory of
specified pics.
#!/bin/sh
# miFotos - A simple .xml generator for RSS of JPEG files.
#
# Originally intended for use with the Sony PSP and Mac OS X.
#
# mifotos creates an PSP-compliant RSS .xml filelist of a
# specified directory containing JPEG images.
#
# Version 0.2
#
# Usage: mifotos name_of_slideshow category pathname_to_JPEG_files
#
# Example: mifotos vacation surfing photos/vacation/surfing
# or: mitunes vacation surfing photos*/vaca*/surf*
#
# These examples will create an .xml file named "0surfing.xml" in
# the current directory. The filelist will be suitable for an image RSS
# for the Sony PSP.
#
# In testing, it appears that the [current] PSP's firmware only allows
# recognition and feed of five images possessing the same <pubdate>?
# An inelegant solution, used here, is to issue a sleep(1) command inside
# the for loop in order to add one second to each <item>'s <pubdate>.
#
# For some reason, RSS <item> feeds for .mp3 files are not afflicted with
# the same behavior.
#
# Bugs: no error checking
#
# NOTE: if using Mac OS X, uncomment the 822-date line below;
# under Linux, use the date command with the -rfc option, else
# RSS feed on the Sony PSP will fail. RSS .xml for the PSP
# must use RFC822 or W3C date/time formatted strings.
#
# In this version you must also edit the embedded URLs for your setup.
# You should be able to see where to make the edits, right?
# :-)
#
# Create filelist .xml header
echo "
<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>$1</title>
<link>http://192.168.1.102/~bball/psp/photos/</link>
<description>My PSP JPEG filelist</description>
<language>en-us</language>
<copyright>2007</copyright>
<lastBuildDate>Mon, 29 Jan 2007 06:20:09 GMT</lastBuildDate>
<generator>linux_author</generator> <webMaster>sue_mee@yoohoo.com</webMaster>
" > 0$1.xml
# loop through designated directory
for file in $3/*jpg
do
# necessary to increment date/time stamp on each <item> - bug in PSP firmware?
sleep 1;
echo " <item>
<title>$file</title>
<description>$2</description>
<pubDate>$(822-date)</pubDate>
# <pubDate>$(date -rfc)</pubDate>
<enclosure url=\"http://192.168.1.102/~bball/psp/photos/$file\" length=\"\" type=\"image/jpeg\"/>
</item>
" >>0$1.xml
done
#end of imagelist.xml
echo "
</channel>
</rss>
" >>0$1.xml
Have a happy! i'll post additional info, hacks, or favorites here as
time permits.
Suggestions? Mail them to:
main(){int j=-1;char t[]="rfnqyt?%ggfqqEyz}3twl\n";
while(t[j]!='\n'){putchar(t[++j]-'\05');}return 0;}