View Single Post
Old 08-29-2014, 11:17 PM   #170
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,002
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by jecilop View Post
Question/Request for Epub Merge Plug-in Developer ( I think I'm putting this in the correct place by following the Plug-in Thread).
Yes, this is the most appropriate place for questions about EpubMerge. And thank you, BTW, for the very complete problem report with examples. I appreciate it.

Quote:
Originally Posted by jecilop View Post
Re: Merged book metadata jacket page replacing metadata jacket of 1st book when updating the file.

I've noticed that when books are merged, the metadata jacket of the first book is replaced with the metadata jacket for the merged book when you update it to include comments you want to see in the merged book. All other books metadata jacket pages remain as they were. I believe this means that it "updates" and replaces the page file with the new one. This file is "jacket.xhtml" .
...
I confirm that I see the same behavior, but I disagree a little with your characterization of it.

EpubMerge is doing exactly what it says--it's merging the epubs together. Each original epub's content is in a directory inside the final epub, including any jacket page.

(The file layout as depicted in Calibre's Edit Book feature is not a true representation of the actual epub--it pulls the contents of the first merged book up to the top level. Use Tweak Book, now Ctrl-T to see the true zip file layout.)

And if you stop there, it's all correct. Each individual ebook's jacket is in place and intact.

The problem is when you use Polish to add/update an overall jacket page. It replaces the first jacket it finds, even though it's not at the top level of the epub zip file.

(OTOH, if you add/update jacket using the Modify Epub plugin, which pre-dates Polish, it adds a new overall jacket as expected. Modify Epub expects jacket.xhtml to be in the same directory inside the epub zip as the opf file, generally the top.)

Calibre also uses a special HTML tag, <meta name="calibre-content" content="jacket"/> inside the jacket.xhtml files to identify jacket files.

So I see four possible fixes for this:

Change EpubMerge to change the name of the jacket.xhtml files when merging, as you suggested. This can cause problems if other epubs use files named jacket.xhtml that aren't calibre jacket files such as potentially breaking internal links. It would also have to be reversed on UnMerge. Plus for azw3 Polish doesn't consider the file name at all when looking for jacket files, only the <meta> tag. Convert appears to use only the <meta> tag for all formats.

Change EpubMerge to insert a top level jacket file itself for Polish to find, another idea you suggested. But if you use Polish to remove the jacket, then you're back where we started--add/update (or remove again) at that point would affect the first merged book's jacket.

Get Kovid to change Polish (and Convert and possibly other features) to only use top level jacket.xhtml files. There are probably good reasons why calibre behaves as it does--I can think of a few myself, for example some formats don't have a file layout like a zip file.

Use Modify Epub plugin instead of Polish to insert/update metadata jackets. This is what I'd suggest as a interim solution, at least.

Change EpubMerge to change the <meta> tag inside jacket.xhtml files so calibre won't recognize them as jacket files anymore. This is safer, but would also have to be reversed on UnMerge. And deal correctly with merges of merges and unmerges of unmerges. This is the best candidate solution so far, but it involves changing the book contents--something I've been reluctant to do.

I'm going to think about it for a bit more before I do anything. Discussion is welcome.
JimmXinu is offline   Reply With Quote