code » gutenPod v0.1
Introduction
This is a program designed to reformat long text documents in a format that is readable by the iPod Note Reader. It was originally written with Project Gutenberg in mind, hence the name.
The iPod Note Reader cannot display documents of more than 4Kb, so it is necessary to split text up if you want to read it all. In addition, the program provides hyperlinks between pages. You can read more about writing for the iPod here.
Using the program
From the command line
perl gutenpod.pl file1 [file2...]
Using the Platypus version
Drag and drop your text files onto the application icon that looks like this:
Directories will be created for each one as described below.
Details
The program takes any number of text documents as its arguments. It outputs a directory in the same location that has the same name as the document with .ipodnote appended, so gutenberg.txt goes to gutenberg.txt.ipodnote. Inside this directory are three-digit numbered files.
Rename the directory as desired, and copy it to the Notes directory in your iPod. Go to this directory and start reading at 001. You will notice that there are "previous" and "next" links on each page - these will take you to the previous and next pages if clicked.
Files
- gutenpod.txt (2K) - the raw code, you can run this on any platform. Well, as long as you've got Perl on it. Don't be daft. I'd rename it from
gutenpod.txttogutenpod.plmyself. gutenPod.zip (45K) - this is an easy-to-use OS X version made with Platypus. You can drop text files onto it and it will convert them automatically, without you having to open a terminal. Download, unpack and move to a useful place.
Platypus is a fantastic program that allows you to package up scripts, Perl, Ruby, bash, Python, anything, and turn them into a nice OS X-looking application. I thoroughly recommend it for any script hacker like myself without the time or energy to do things properly in OS X.
- An example book from Project Gutenberg converted with gutenPod - Thomas More's Utopia.
Enhancements
This would be a lot more convenient for people generally if it were online, they could point it at a Gutenberg document and it would grab it, convert it and return it as a zipped directory. That's a possibility. However, it seems difficult for me to grab a specific Gutenberg plain text file - the user would have to specify the URL. Or maybe they could just upload the file themselves and it would convert it, which would be a generous thing for me to provide. In that case, I'd probably convert the program to PHP, which would make the upload/download thing easier (I think).
The paragraph and formatting detection could be a whole lot smarter. Unfortunately, text documents don't keep to a consistent style. Perhaps there should be different options that can be set.
Notes
The first version of this was written on Friday 15 October 2004. All the usual disclaimers apply, I take no responsibility at all for any exotic way you manage to screw your iPod with this program if you choose to use it.
New icon added 2004/10/16, 1:00 PM