Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 02-16-2011, 11:02 AM   #1
kazbates
Wizard
kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.
 
kazbates's Avatar
 
Posts: 2,627
Karma: 406616
Join Date: Dec 2008
Location: Northern Virginia
Device: SurfacePro, SurfaceBook 2
Help Merging Multiple Small Epubs into One Large Epub

I am trying to find a way to merge a set of small emancipated epubs into one large epub. I have looked through Sigil but am confused as to how to copy contents from multiple files to include in one single file.

Previously, I created html files, copy and pasted the content into a MSWord doc file, and then loaded that into Book Designer to create my final product. Unfortunately, the option of directly creating an html from the original ebook is no longer viable since the new agency choke-hold is limiting download choices.

I have looked into epub to html conversion software but thought I would ask the great minds here at MR first.

Any suggestions?
kazbates is offline   Reply With Quote
Old 02-17-2011, 12:01 AM   #2
pholy
Booklegger
pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.
 
pholy's Avatar
 
Posts: 1,801
Karma: 7999816
Join Date: Jun 2009
Location: Toronto, Ontario, Canada
Device: BeBook(1 & 2010), PEZ, PRS-505, Kobo BT, PRS-T1, Playbook, Kobo Touch
Making an onmibus out of epub files...

It's a little hard to describe, but I think I know how I would go about it. You have to understand how epubs are put together, so let me know if you need to learn that bit too.

First I would unzip each book into its own directory, then, I would create a destination work directory. Put the mimetype file and the META-INF directory (with its container.xml file) in the work directory. Now your omnibus volume will need a single content.opf file and a single toc.ncx file, so create empty files for them in the work directory.

Here's where things will get tricky. For each book, create a directory in the work directory. Into the book directory, copy the font, image, css, and html files from the unzipped epub directory. Do not copy the content.opf and toc.ncx files into the book directory. Instead, use the contents of those file to create the new content.opf and toc.ncx file in the work directory.

The new content.opf file will have a new metadata section describing your omnibus, but the manifest and spine sections will be made by combining those sections from each of your books, remembering to add in the new book directory into each file's path.

The new toc.ncx file will also be made by combining the existing toc files, but you will probably want to make a two (or more) level table of contents. The outer level will be new, with an entry for each book, then between each of those entries you can put the entries from each book's toc.ncx file. By the way, in Windows, you would be using Notepad++ to create these files, not Notepad or Word. In Linux, I'd use vim or gedit.

Once all that's done, zip it up and see if it validates using FlightCrew; then fix the errors until it does...

Do you begin to see why Sigil doesn't do this for you automatically? Oh, and by the way, I haven't actually done this for any collection of books, so I'm sure I left out lots of details that will bite me the first time I try it. If anybody has other suggestions, feel free to toss them into the pot.

Last edited by pholy; 02-17-2011 at 12:02 AM. Reason: Separate the paragraphs
pholy is offline   Reply With Quote
Advert
Old 02-17-2011, 02:14 PM   #3
kazbates
Wizard
kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.
 
kazbates's Avatar
 
Posts: 2,627
Karma: 406616
Join Date: Dec 2008
Location: Northern Virginia
Device: SurfacePro, SurfaceBook 2
Pholy, Thank you so much for responding! I was starting to think I had asked a really silly question and people were rolling their eyes at me. I will try to walk through the steps you gave me and see how far I can get. . .It might take me a couple of days, though.
kazbates is offline   Reply With Quote
Old 02-24-2011, 09:19 PM   #4
JimmX
Junior Member
JimmX has a complete set of Star Wars action figures.JimmX has a complete set of Star Wars action figures.JimmX has a complete set of Star Wars action figures.
 
Posts: 1
Karma: 286
Join Date: Feb 2011
Device: Nook
Actually, I wanted the same thing--so I made a program to do it.

I just released it today:
Quote:
I've made a standalone, command-line interface python program that can
merge multiple epub books together into one, combining the authors and
table of contents. My motivation was to be able to combine a series
of stories together into one epub.

Roman Kirillov has graciously allowed me to put it in the
fanficdownloader source repository. You can find epubmerge.py in the
fanficdownloader directory of the fanficdownloader hg repository, or
get it directly from:

http://fanficdownloader.googlecode.c...r/epubmerge.py

You'll need python installed to use it, and you'll need to call it
from command line. An example invocation would be:

python epubmerge.py -o SeriesName.epub -t "Series Name" story1.epub
story2.epub

I've tested it with epubs from my most common sources (Calibre, Sigil,
Baen Publishing, fanficauthors.net, tthfanfic.org). Let me know if
you have problems with other sources.

This only works with non-DRM epub files (Nook and other readers).
mobi files (as used by Kindle) are a lot more complicated. I don't
have any plans to work with mobi.
Jim
JimmX is offline   Reply With Quote
Old 02-25-2011, 08:43 AM   #5
kazbates
Wizard
kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.
 
kazbates's Avatar
 
Posts: 2,627
Karma: 406616
Join Date: Dec 2008
Location: Northern Virginia
Device: SurfacePro, SurfaceBook 2
Jim, Thank you!!

I'm afraid my programming days are long over (I started with Cobol, PL1, and C before they added all the +'s ), so I had no hope of accomplishing this on my own.

I will make some test cases and let you know how it goes.

Thanks again.
kazbates is offline   Reply With Quote
Advert
Old 02-25-2011, 11:09 AM   #6
GeoffC
Chocolate Grasshopper ...
GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.
 
GeoffC's Avatar
 
Posts: 27,600
Karma: 20821184
Join Date: Mar 2008
Location: Scotland
Device: Muse HD , Cybook Gen3 , Pocketbook 302 (Black) , Nexus 10: wife has PW
Jim

Welcome to Mobileread ....



Do stay and join in with us .....
GeoffC is offline   Reply With Quote
Old 02-25-2011, 07:56 PM   #7
konrad
Member
konrad began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Feb 2010
Device: none
Hi Jim
Downloaded your epubmerge.py but am having trouble getting it to work. I took 3 epubs , and your script , put them in a separate directory and ran the script ...didn`t get any errors but didn`t get a merged epub either.This is the command I used " E:\1>epubmerge.py -o all.epub -t Series 1.epub 2.epub 3.epub " Is there something I am not doing correctly? I have ActivePython 27 installed on my machine and other python scripts are working .Any help would be appreciated. Thank you.
konrad is offline   Reply With Quote
Old 02-26-2011, 12:17 PM   #8
konrad
Member
konrad began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Feb 2010
Device: none
Hello again Jim
Found the problem with running the epubmerge script. It was something I was doing wrong. It is working great now.Thank you for coming up with this script ...it was something I had been looking for.
konrad is offline   Reply With Quote
Old 03-01-2011, 09:25 PM   #9
lebleaux
Member
lebleaux began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2010
Device: none
Jim,
Just attempted to use epubmerge with python26. Got this:

File "epubmerge.py", line 293, in <module> main()
File "epubmerge.py", line 255, in main newnav=navpoints[0].cloneNode(True)
Indexerror: list index of of range


The invocation command was:

python26 epubmerge.py -o out.epub a.epub b.epub

Have used a number of combinations of parameters, all with the same result. I do get output which I can view in winrar and get to the text of the stories, but I can not open the output in Sigil.

Any ideas
lebleaux is offline   Reply With Quote
Old 03-01-2011, 09:42 PM   #10
lebleaux
Member
lebleaux began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2010
Device: none
Further info. I opened each epub in Sigil, saved them and then ran epubmerge. Worked without a problem .... I like it
lebleaux is offline   Reply With Quote
Old 04-21-2011, 01:19 PM   #11
Tom1976
Junior Member
Tom1976 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2011
Device: Nook
Is this still teh best way to go?

I have teh exact same need to merge multiple ePubs into the chapters of a single ePub to consolidate files and am new to all this... is this recommendation (the script in the thread above using Active Python 2.7) still the best (i.e. easiest) way to go? Thanks!
Tom1976 is offline   Reply With Quote
Old 07-23-2011, 01:19 PM   #12
superanima
W2E & ePub freak
superanima began at the beginning.
 
Posts: 38
Karma: 10
Join Date: May 2009
Device: cybook gen3 + boox60
The given example don't work with my epubs, it gives me this error:
Code:
output file: merge.epub
Traceback (most recent call last):
  File "epubmerge.py", line 373, in <module>
    main(sys.argv[1:])
  File "epubmerge.py", line 72, in main
    options.striptitletoc)
  File "epubmerge.py", line 177, in doMerge
    source=firstmetadom.getElementsByTagName("dc:source")[0].firstChild.data.encode("utf-8")
IndexError: list index out of range
superanima is offline   Reply With Quote
Old 07-24-2011, 03:02 PM   #13
kazbates
Wizard
kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.kazbates ought to be getting tired of karma fortunes by now.
 
kazbates's Avatar
 
Posts: 2,627
Karma: 406616
Join Date: Dec 2008
Location: Northern Virginia
Device: SurfacePro, SurfaceBook 2
I have found that the script only works with certain types of epub files. First, the file must be drm-free. Secondly, it has only worked for me with files that I have Opened and Saved in Sigil.
kazbates is offline   Reply With Quote
Old 09-14-2011, 10:52 AM   #14
apro
Junior Member
apro began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Sep 2011
Device: QUMO Libra 2
Smile

Hi,
I've taken JimmX's python script, modified it a bit to remove chapters from original books and made executable with py2exe.
I used it without any flags.
As a result you get one epub file with all books merged and available in TOC, prefixed with number of the book (01. Title, 02. Title, etc.). Chapters of merged books are not included.
I've also included modified script as an attachment.
Attached Files
File Type: zip epubmerge.zip (2.37 MB, 945 views)
File Type: txt epubmerge.py.txt (16.5 KB, 1201 views)
apro is offline   Reply With Quote
Old 09-15-2011, 02:18 AM   #15
wannabee
Media Bloke
wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.wannabee ought to be getting tired of karma fortunes by now.
 
Posts: 2,381
Karma: 113956855
Join Date: Sep 2010
Location: NSW - Australia
Device: iOS
That python stuff goes over my head mate, but it sounds pretty cool. Welcome to MR. You just posted onto the end of and old thread which won't attract as much attention as if you start a new thread.
wannabee is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging ePubs question jhempel24 Sigil 0 01-11-2011 01:39 AM
Feature Request - Merging of ePubs fcoulter Sigil 6 07-29-2010 05:29 PM
Migrating, Merging and Multiple Calibre Folders daffy4u Calibre 3 06-28-2010 04:53 AM
Consolidating/merging multiple formats flinx1 Calibre 1 05-06-2009 01:17 PM
Merging multiple scribbles at one time ragdoll iRex 3 07-30-2008 01:39 AM


All times are GMT -4. The time now is 04:01 PM.


MobileRead.com is a privately owned, operated and funded community.