View Single Post
Old 08-18-2016, 04:02 PM   #1470
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: 6,999
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by JimmXinu View Post
This is being caused by an undesirable interaction between Polish Book and covers inside Anthologies. Polish Book is apparently removing (renaming?) the cover.xhtml file inside a sub-book simply because of the file name.
Here's what's going on:

- EpubMerge (which is what FanFicFare uses to create anthologies) puts the contents of each sub-book, including the covers, in directories inside the epub. EpubMerge's UnMerge is used to update existing anthologies. It extracts the sub-books' files from those directories before running FFF update on each.

- Polish Book uses various heuristics to find existing covers because epubs with misconfigured metadata are unfortunately common. Those heuristics find and remove the saved covers inside the anthology sub-books thinking that they are covers with incorrect metadata. Theoretically, this could be fixed in Polish Book; but given that misconfigured books are probably more common, I don't know that Kovid would accept it. I haven't spent the time to figure out how.

- Because the covers have been removed, after UnMerging, the sub-books fail to parse because the missing cover is still in the UnMerged metadata. That's the error you reported. I can fix that problem by adding code to FanFicFare to handle the missing cover more gracefully. But it kicks the problem down the road because:

- FFF re-uses the existing sub-books as-is if they didn't need new chapters. So they are still missing the cover.xhtml file when they get re-merged, which causes EpubMerge to end up with references to missing files. This causes problems with TOC links.

- I can fix that problem in turn by adding code to EpubMerge to handle missing files more gracefully. The sub-book covers have still been removed, but at least it's not failing. That leads to the next problem:

- UnMerge assumes that the sub-books are the only content in the epub. Covers added to the merged book are discarded during the UnMerge when anthologies are updated. So now Polish has removed the individual book covers and UnMerge has removed the overall cover that Polish added.

Here's what could be done about it:

- Don't Polish anthologies. Not an intuitive solution, but that's what can be done today. Modify Epub (PI) doesn't appear to cause the same problems.

- I can publish the changes mentioned to better handle missing files in FanFicFare and EpubMerge. That will prevent outright failures, but does potentially lead to cover 'erosion' as described above. These changes probably be added regardless, for the benefit of existing Polished anthology books.

- I can at least partially address cover 'erosion' if I add code to save and reuse anthology overall covers. But where does that end? What if somebody's added a metadata jacket file? Other files? I don't want to go down that road, but I might for covers only.

- Modify Polish Book to not effect anthology sub-books. I'm not sure how complex that would be, or if Kovid would accept it.
JimmXinu is offline   Reply With Quote