11-17-2011, 03:01 PM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2011
Location: USA
Device: Android phone
|
Easy conversion with 1 chapter per file?
I have a number of books (articles) that are 1 chapter per file in HTML, 1 book per directory. I've been having trouble making Calibre easily change those to an epub doc. So help?
I eventually figured out that it works better when I put all the files into a zip file and try to add/convert that. I can get it better still if I create a toc.html much like in the user manual -- a bit of a pain but I can write a perl script to do that. (I don't know python.) I could concat all the files into a single file per book, but that has it's own drawbacks, unless that's the secret to making this process work (then I'll live with the drawbacks). I was hoping that there was an easy way to tell Calibre to take all the files in "this directory" and create an epub. Is there such a command or plugin or whatever that someone can point me to? I didn't see anything like that in the user manual. Also, how do you do the above from the command line? I have more of these dirs than I care to convert by hand, but the user manual doesn't give any hints that help (or else I can't find the right parts). So, any pointers to docs, web pages, whatever, would be very helpful. I'm sure I can't be the first with this problem, but my searching has not found anything so far. Thanks! Kevin |
11-17-2011, 03:04 PM | #2 | |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
|
|
Advert | |
|
11-17-2011, 03:32 PM | #3 | |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2011
Location: USA
Device: Android phone
|
Quote:
I have a number of dirs with files like: 01.html, 02.html, 03.html, etc. I'm looking for an easy way to use Calibre to take such a dir and convert it to an epub doc. I can create a toc.html file as mentioned in the FAQ. What I can't find is an example of how to use Calibre to do this conversion/creation from the command line (whether I need to create the toc.html or not). I need to expand beyond the GUI. I need this to be easy and from the command line because I get new "books" all the time. I tend to download stuff then install it on my phone/tablet to read "offline", then delete it later. So my question is more about ease of use than how to make a doc look good. I almost don't even need a ToC, other than that helps to ensure that all the chapters are put in the correct order. Amusing note, in my experimentation when I first started, without a toc.html file, Calibre created my epub with all the chapters in reverse order. Oops! So, if there's a FAQ for this, please point it out. Thanks! |
|
11-17-2011, 04:23 PM | #4 | ||||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Quote:
Quote:
|
||||
11-17-2011, 04:36 PM | #5 |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Note: the Index.html file needs to work from where it is located when passed to Calibre.
This means it will open each of the pieces correctly, and (Local)Images are shown properly. Calibre will follow the Local links and src's and include them. |
Advert | |
|
11-18-2011, 01:11 AM | #6 | ||
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2011
Location: USA
Device: Android phone
|
Ok, so it sounds like I should be able to do what I need with this index/toc file and handing that to "ebook-convert" and possibly also using "calibredb add". Let me try some experimentation along those lines. I found ebook-convert in the manual, but it really wasn't clear to me how I should use it for what I needed.
Quote:
Hopefully the info you've both shared will get me over the next hurdle. I see no reason Calibre can't solve this problem; it seems to have all the parts. I love perl and CPAN, but CPAN's Epub module looks hideously complex, hence my desire to find something simpler. I'll post something here if I can get it working. But this seems like a problem that many others should have too and a documented solution should be available -- somewhere. Thanks! Kevin |
||
01-15-2012, 01:12 AM | #7 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2011
Location: USA
Device: Android phone
|
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Losing Chapter function after conversion | jasewell | Conversion | 17 | 02-21-2011 08:20 AM |
Easy Instructions for Converting a File to Kindle? | crutnacker | Amazon Kindle | 5 | 01-02-2010 07:48 AM |