Sunday, November 23, 2008

More on the Nokia 5310 XpressMusic

Having just posted a full review of the Nokia 5310, I would like to make some additional comments and even give you guys a free goody (I like giving out free goodies).

But, first, I promised in my last blog to post some scripts I use to convert HTML pages in to a form my phone can use.

The example script I will post allows me to convert books available in HTML format at Baen books in to a form that can easily be read in my mobile phone. For example, here is my script that splits up one of my favorite books there, Wizard's Bane (which was, indeed, my favorite book right after I graduated from high school), can be split up in to a form that can easily be read with the 5310's limited HTML browser using the following line noise script:


# First we make lots of small files
for a in 0671878468__*htm ; do cat $a | gawk 'BEGIN{RS="<p onmouseover="} {gsub(/\<a (id|name)=\"[^a]+a\>/,"");sub(/^\"PNo\([0-9]+\)\"/,"<p");sub(/\<\>/,"");print}' | egrep -v '^<a' | perl -e '$b=1;$c=sprintf("3d",$b);open(F,"> '$a'_${c}_.html");while(<>){if(/^<p>/){$a++}if($a > 50){$a=0;close F;$b++;$c=sprintf("3d",$b);open(F,"> '$a'_${c}_.html");}print F $_}'; done

# Then we make the naming more sensible
for a in *html ; do mv $a $( echo $a | awk -F_ 'NF == 6 {print "0" $4 "-" $5 ".htm"} NF == 5 {print $3 "-" $4 ".htm"}' | sed 's/.htm//' ); done


Here, the Shell/Perl script in the first part splits up the files in to smaller files; with each file being 50 paragraphs long (the "a > 50" part of the Perl script). The second part takes the filenames and gives them sensible names like 01-001.htm ("Chapter one, part one").

I have used this and similar scripts to put a number of ebooks in my phone, such as a few Baen books, the Bible, and Huxley's "Brave New World" (which my roommate downstairs is doing a book report on right now).

Another thing I'm working on is a theme. The name of this theme is "Pink Planet", and it's a pink version of a Dark Planet mobile theme I downloaded online. You can find my work on this theme here (to give credit where it's due, my progress bar is the progress bar from an iPhone copycat theme that I changed to be purple instead of smoke gray).

Like customizing *NIX desktops in the mid-1990s, a lot of editing by hand of text files is needed to work on the theme properly (you can also use Nokia's theme editor called "carbibde.ui" to edit the themes, but it's more efficient to just use The Gimp to edit images and a text editor to edit the .xml files by hand).

Nokia ".nth" themes are ".zip" files with a different suffix (Phil Katz's legacy is that his ".zip" file format is the standard way to compress and make multiple files available as a single file). To edit the theme, just change the suffix from ".nth" to ".zip", extract the files in a directory, then recreate the .zip file after making your changes. Also make sure all of the files aren't in subdirectories, or Nokia's theme loader won't be able to find the theme.

Anyway, I will post more blogs about some more cool things this small phone--which is about the size of a Snickers candy car (or an iPod nano)--can do later on this week.