O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  

Buy the book!
iPod and iTunes Hacks
By Hadley Stern
October 2004
More Info

Convert Text Files into iPod Books
Convert the many readily available text files on the Web into readable iPod notes.
[Discuss (0) | Link to this hack]

Since there aren't a ton of books out there to read on your iPod, if you want more choice you will have to get down and dirty and convert some text files yourself. Finding source material isn't hard; check out Project Gutenberg (http://www.gutenberg.net)for thousands of free books.

Getting the Files onto Your iPod

For the purposes of this hack, I've decided to go with one of my favorite authors, James Joyce. Rather than overload my iPod with something as grandiose as Ulysses, I've decided to download the much shorter collection of short stories, Dubliners (available from Project Gutenberg at (http://www.gutenberg.net/text01/dblnr11.txt), as shown in . Feel free to choose another text to walk through these steps with me, although if you haven't read Dubliners, I highly recommend it.

Figure 1. Project Gutenberg etext of Dubliners, by James Joyce

After saving this file to my local drive, I need a way to convert it into something that the iPod can handle. The iPod can read any plain-text file put in its Notes folder, as long as the file isn't greater than 4 KB in size. Any text in the file over the 4-KB limit will be cut. As dblnr11.txt weighs in at 388 KB, a full 97 times the allotted size, we need to split up the file.

If you're using Windows, you will have to do this manually within a barebones text editor such as Notepad. Cut and paste successive segments of the original document into new files, naming all of the files in a numeric order and placing them inside one folder, which you will copy into your iPod's Notes folder. If you're on a Mac, you could do the same thing in TextEdit, but there are two programs that can help you get around the monotony of this task: Text2iPod X (http://homepage.mac.com/applelover/text2ipodx/text2ipodx.html; free) and iPoDoc (http://burtcom.com/lex/#Anchor-iPoDoc-49575; free).

Text2iPod X converts your text file into a Contact file that you can place inside the Contacts folder on your iPod. The benefit of this method is that the Contacts feature works on older iPods that do not support the Notes feature of newer iPods. The down side is that while the file can be larger than the 4-KB limit of the Notes files, it will still tend to get cut at around 32 KB. This was the case when I tried to load up the converted Dubliners via the Contacts menu on my iPod. Nevertheless, if you have an older iPod, cutting the text into a dozen 32-KB text files (which you then run through Text2iPod X) is a workable solution.

Your other option, iPoDoc, is a very effective little Applescript droplet that splits up your files into 4-KB chunks. Simply make sure that your iPod is loaded on your Mac and drag the dblnr11.txtfile onto iPoDoc. The script will launch and quickly run. If your iPod isn't attached, the script will end, displaying a dialog saying that the iPod was not found. Otherwise, it will quickly split up your file into multiple 4-KB files, linked to each another and placed by tens into subfolders; the subfolders will be organized within a folder by the name of dblnr11.txt inside the Notesfolder on your iPod. See to get an idea of how iPoDoc splits up files.

Figure 2. The folder hierarchy for dblnr11.txt after it has been run through iPoDoc

The left column contains all the files and folders inside the Notes directory on my iPod. Inside the main dblnr11.txt folder, there are 11 subfolders, depicted in the middle column. In the right column, we have the 10 4-KB text files that make up the first section of the book. On the iPod, simply navigate to the first file, 000_dblnr11.txt,and select it to begin reading from the beginning. At the end of the file—and this will be wherever the 4-KB limit was reached, even if it's in the middle of a word—iPoDoc will have inserted a NEXT PAGE link to the next file in the sequence. Click on that link and it will open up 001_dblnr11.txt, which in turn will end with a link to 002_dblnr11.txt.

To go back a page or navigate to a previous section, you will have to hit the Menu button on the iPod and navigate to the name of the page to which you want to turn, just like you do when selecting another song. Take note of the way the numbering works for ordering within the iPod, because it will be useful if you decide to make your own iPod book

C. K. Sample III

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.