View Single Post
Old 04-01-2022, 05:26 PM   #52
Terry Brown
Enthusiast
Terry Brown began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jun 2010
Location: Portland, OR
Device: M1 Max Mac Studio, iPad Pro 2018 12.9, iPhone 7
epubpaginator as a calibre plugin

Quote:
Originally Posted by RbnJrg View Post
Very nice! Could you adapt your python script as Sigil (or Calibre) plugin?
Calibre doesn't allow multiple copies of a single format, like epub, within a single calibre record. That means that doing this is like building a conversion tool where the source is epub and the destination is a replacement epub that is the output of epubpaginator. That is fraught with all sorts of bad possibilities should epubpaginator destroy the functionality of the epub yet merrily go ahead and replace the existing, good one. I could back up the existing file somewhere before doing this, then at least the user can recover. I could even provide a "recovery" tool that would restore the original epubs to Calibre.

I could also convert the file, present it to the user to peruse using ebook-viewer (a calibre ebook reader). If the user approved, she could then choose to overwrite the existing file as well as having a copy.

You can see why I am reluctant to create such a beast.

It is quite simple for me to add functionality to epubpaginator that creates a new book record (with a new id) in your calibre database. This new record would hold the paged epub file as a format. I can also easily add a tag "paged" to this book to allow easy selection of books that have paged epubs. I can also add "Paged" to the title of the new book.

However, when I do this, the duplicate records complicate looking at your database in calibre. Who wants two copies of every book? And, if you track reading books with tags or whatever, then you probably need to track in two places.

It is also easy to add the paged epub to Calibre without generating a duplicate record by modifying the extension name of the paged epub, calling it, for example Mybook.epub_paged. This works for storing the new format, but now applications don't know what to do with the format, so that is also a mess.

It's also easy to create a new calibre library, called, for example Paged_Epubs and put the paginated epubs there. But again, the duplication complicates tracking reading status, etc.

Another idea would be to separate the functionality of verifying the paginated books from the pagination itself. Then, you paginate a bunch of books and store them in a directory. After you convince yourself that they are all properly formatted, the new tool would insert them into the calibre database, replacing the originals.

Comments? Suggestions?
Terry Brown is offline   Reply With Quote