View Single Post
Old 01-15-2012, 01:12 AM   #7
kbrannen
Junior Member
kbrannen began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2011
Location: USA
Device: Android phone
Lightbulb The prototype answer

For anyone else wanting to do something like this, here's a prototype program to do what I was after. I think there are 2 possible ways to create the EPUB file for a "format shift":

1. Concat all the chapters into 1 big file, then convert that.
2. Create a ToC file and use that to handle the chapters correctly.

Possibility #1 isn't impossible, but it's not always trivial to do either (having to figure out how to rip apart the files and then putting just the right pieces back together), and it produces fairly ugly files that don't have a ToC.

Once I figured out how OPF files work, I decided to use these to pursue #2. So for me, I download all the files for 1 story (from fanfiction.net in this case) into a directory. Part of my download process cleans up the files by removing SCRIPT tags and other garbage I don't want. Once that's done, I can go to that directory in my terminal window and run the attached file, or even write a small script file on the command line to do several directories in one go. The result is an EPUB file for each dir/story, that I can copy to my Android phone and use with FBreader, or copy to my Nook to read. Once read, I can delete it.

I hope this helps others...

Comments about the program are at the top of the file. The most important ones are:
* You must have perl and Calibre installed to make it work.
* This is run from a command line (no GUI). While I developed and tested it on Linux, it should work on Windows and Mac without too much trouble, assuming you have its dependencies installed.
* Run the program without any arguments to get a usage statement.
* There are a number of possible enhancements to this program to make it "better", but it's very useable as is.
* Oh, you're free to use this or give it others for personal usage.

Kevin
Attached Files
File Type: pl makeebook.pl (6.7 KB, 142 views)
kbrannen is offline   Reply With Quote