View Single Post
Old 07-27-2007, 10:07 AM   #1
kenbaldwin
Connoisseur
kenbaldwin began at the beginning.
 
Posts: 74
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
text file tricks

I prefer to keep my library ‎as plain text, so I can read it on all kinds of devices. Plus it's easy to manipulate programmatically. Here are a few tricks I use to improve the experience of reading text files on the Reader, if anyone else is interested...

(1) The Reader renders plain text using Dutch/Times 12. I prefer sans serif (Swis). This can be changed by editing main.xml and reflashing the firmware using the universal flasher:
https://www.mobileread.com/forums/showthread.php?t=10900

Look for these lines:

Code:
<style font="Dutch801 Rm BT">
  <style id="text" size="12"/>
</style>
and move the nested text style definition up inside the Swis style element:

Code:
<style font="Swis721 BT">
  ...
</style>
You'll probably be tempted to increase the font size too, but oddly this seems to have no effect. I just use the Medium (1) scale level.

(2) The Reader does not extract any metadata from a TXT file. The filename is used as the document title, and no author is displayed. Since I name my files consistently in the form "author - title.txt", I use the attached make_cache.pl Perl script to parse the filenames and populate the cache.xml appropriately. (This assumes that you're using a memory card to transfer books, as I do.)

The script should correctly update the cache when you add or remove books, preserving any existing bookmarks. It only works for TXT files. Type "make_cache.pl -help" for details.

By default, the scripts sets the scale factor to 1 (Medium), so you don't need to paginate a new book twice (once at the Small scale factor, then again at the Medium scale factor). but you can change this using the -scale option.

(3) When formatting books, I put a double newline between paragraphs to separate them. The attached book_convert.pl script is the main tool I use. It (usually) does a pretty good job on TXT, PDB, RTF, DOC, HTML, and LIT. You need catdoc installed for DOC files, and ConvertLit for LIT.

If anyone else is reading text files and has any additional suggestions, I'd like to hear them. In particular, has anyone figured out how to generate the layout information in cache.xml?

Ken
Attached Files
File Type: xml main.xml (33.5 KB, 521 views)
File Type: pl book_convert.pl (15.0 KB, 449 views)
File Type: pl make_cache.pl (4.5 KB, 329 views)
kenbaldwin is offline   Reply With Quote