View Single Post
Old 11-16-2008, 04:20 AM   #15
ShellShock
Wizard
ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.ShellShock ought to be getting tired of karma fortunes by now.
 
ShellShock's Avatar
 
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
Thanks for your help, and such a nice little utility! This is just the thing I need as I like to reformat the lrfs I download in order to get as much text as possible on the screen (smaller fonts and margins).

This is the output using -e:

Code:
lrf2lrf -e "Silverberg-Live-Again.lrf"
Parsing LRF...
Creating XML...
LRS written to .Silverberg-Live-Again.lrs.tmp
TextStyle ObjId=75 Fontsize = 100
TextStyle ObjId=77 Fontsize = 100
TextStyle ObjId=78 Fontsize = 100
TextStyle ObjId=81 Fontsize = 60
Recommend PageStyle = 72
Found PageStyle = 72 Occurrence = 20
Recommend TextStyle = 75
Found TextStyle = 81 Occurrence = 2
Found TextStyle = 77 Occurrence = 20
Found TextStyle = 75 Occurrence = 22
Found TextStyle = 78 Occurrence = 7
I have converted the lrf to lrs and found that 75 is used for chapter numbers, whereas 77 is used for the actual body text. Note that objid 77 has 20 occurrences, whereas objid 75 has 2 more - so when I used the -s switch before, it would have changed object 75 and not 77.

I also tried the following command:

Code:
lrf2lrf -f 100,80 -o "Silverberg-Live-Again.new.lrf" "Silverberg-Live.Again.lrf"
Parsing LRF...
Creating XML...
LRS written to .Silverberg-Live-Again.lrs.tmp
LOOKING FOR 72, 100,80, 80
Parsing LRS file...
Writing to output file...
Output written to E:\My Documents\My Library\Reader\Books\Silverberg-Live-Again.new.lrf
This did not work - for some reason it is not looking for objid 77. If we could get this to work it would be great - I could automate conversions by just using -f, and not have to use -e and -x for each book.

I got what I wanted using this command:

Code:
lrf2lrf -x 77 -s 80 -o "Silverberg-Live-Again.lrf" "Silverberg-Live-Again.lrf"
Parsing LRF...
Creating XML...
LRS written to .Silverberg-Live-Again.lrs.tmp
LOOKING FOR 72, 77, 80
Parsing LRS file...
Writing to output file...
Output written to E:\My Documents\My Library\Reader\Books\Silverberg-Live-Again.lrf
I probably want to change the font size for the chapter numbers too - is it possible to have multiple objids for the -x command? (But fixing the -f command would be just as good).

The other thing that occurs to me - when using -s without -x, I believe lrf2lrf uses the maximum number of occurrences to decide which objid to change. This does not work with the Silverberg book because there are in fact more chapter numbers; could the size of the textblock be considered too?

As an example, here are the first two textblocks from a page from the book:

Code:
<Page pagestyle="72" objid="28">

<TextBlock objid="20" blockstyle="76" textstyle="75">
<P>1</P><CR /></TextBlock>

<TextBlock objid="21" blockstyle="76" textstyle="77">
<P>The lamasery rose steeply from the top of the bluff on the Marin County side of the Golden Gate. Feeling a faint cramp in his left calf, John Roditis got out of the car near the toll plaza and, stretching and kicking, looked across the water at the gleaming yellow building, windowless, sleek, ineffably holy as a fountainhead of good karma. It was an extraordinarily warm day. yada yada yada</P><CR /></TextBlock>

</Page>
The length of the inner xml for TextBlock 77 is always much longer than for 75, so that should be the objid to change. I guess this will be true for most ebooks - there will always be an TextBlock element that is much longer than all the others.

I hope you don't mind my suggestions and that they are of some help.


Last edited by ShellShock; 11-16-2008 at 04:58 AM.
ShellShock is offline   Reply With Quote