View Single Post
Old 09-28-2010, 12:29 PM   #11
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Sooo... I just set $preferred_programming_language = "Python" and hacked away. This is the result. Sadly, I couldn't properly test ist, because even with just about 280 out of the original ~20.000 files, Calibre chokes and dies horribly while creating the ePub output. But, at least it should create a HTML file as specified in the link Kovid provided.
The script expects the four files "header", "footer", "prefix" and "postfix" to be in the same directory as the HTML files. (Thus, to use, you need to extract your ZIP to a directory and put the files I attached inside the same directory.) The four files I mentioned contain the beginning and the end of the HTML file together with the text that's prepended and appended to the individual TOC entries. The script expects two parameters, the first one being the filename of the output file, the second one is the filename of the index file, which will go on top in the TOC. If you don't want to use an index file, just misspell the file name, the script shouldn't care.

Please be aware that this is somewhat kludged together (For you Python savvy folks out there, please don't hit me!) and may or may not work. There's no graceful error handling, scratch that: there's no error handling, so horrible, horrible things may or may not happen.
Attached Files
File Type: zip create_toc.zip (1.4 KB, 73 views)
Manichean is offline   Reply With Quote