Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 03-17-2023, 01:35 PM   #1741
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
In my situation, that titlepage.xhtml is the Cover page that Calibre produces. Jacket.xhtml is the jacket Calibre produces (probably as a result of the "Insert Metadata as Page at Start of Book" option under Structure Detection) and sticks in there (usually immediately after the titlepage.xhtml (i.e. in the 2nd position). Tpage.xhtml is actually a title page (usually, the book has it and I just rename it to that). Since that jacket is a Calibre product (which I like and use), it probably doesn't have a standard position. But, almost always, it's in that second position.

The issue I'm having is that for a very small number of books, Modify ePub just keeps putting it in 3rd position and I can't figure out why. AFAICT, in those "Miscellaneous" files, "jacket" shows up only in the .opf file (two locations: manifest (which is unordered) and spine (which is ordered)). In the problematic books, it doesn't matter where the jacket entry is (or where I drag the file in the File Browser). The plugin just moves it to the 3rd position without any obvious instruction to do so.
enuddleyarbl is offline   Reply With Quote
Old 03-17-2023, 01:46 PM   #1742
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
I've attached a scrambled version of one of those books (Naomi Novik's "A Deadly Education"):

https://www.kobo.com/us/en/ebook/a-deadly-education-2
Attached Files
File Type: epub A Deadly Education_ A Novel - Naomi Novik_scrambled.epub (995.3 KB, 87 views)

Last edited by enuddleyarbl; 03-17-2023 at 01:57 PM.
enuddleyarbl is offline   Reply With Quote
Old 03-17-2023, 02:58 PM   #1743
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by enuddleyarbl View Post
In my situation, that titlepage.xhtml is the Cover page that Calibre produces. Jacket.xhtml is the jacket Calibre produces (probably as a result of the "Insert Metadata as Page at Start of Book" option under Structure Detection) and sticks in there (usually immediately after the titlepage.xhtml (i.e. in the 2nd position). Tpage.xhtml is actually a title page (usually, the book has it and I just rename it to that). Since that jacket is a Calibre product (which I like and use), it probably doesn't have a standard position. But, almost always, it's in that second position.

The issue I'm having is that for a very small number of books, Modify ePub just keeps putting it in 3rd position and I can't figure out why. AFAICT, in those "Miscellaneous" files, "jacket" shows up only in the .opf file (two locations: manifest (which is unordered) and spine (which is ordered)). In the problematic books, it doesn't matter where the jacket entry is (or where I drag the file in the File Browser). The plugin just moves it to the 3rd position without any obvious instruction to do so.
Then you are missing the titlepage. What did you do with the titlepage?
JSWolf is offline   Reply With Quote
Old 03-17-2023, 03:00 PM   #1744
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by enuddleyarbl View Post
In my situation, that titlepage.xhtml is the Cover page that Calibre produces. Jacket.xhtml is the jacket Calibre produces (probably as a result of the "Insert Metadata as Page at Start of Book" option under Structure Detection) and sticks in there (usually immediately after the titlepage.xhtml (i.e. in the 2nd position). Tpage.xhtml is actually a title page (usually, the book has it and I just rename it to that). Since that jacket is a Calibre product (which I like and use), it probably doesn't have a standard position. But, almost always, it's in that second position.

The issue I'm having is that for a very small number of books, Modify ePub just keeps putting it in 3rd position and I can't figure out why. AFAICT, in those "Miscellaneous" files, "jacket" shows up only in the .opf file (two locations: manifest (which is unordered) and spine (which is ordered)). In the problematic books, it doesn't matter where the jacket entry is (or where I drag the file in the File Browser). The plugin just moves it to the 3rd position without any obvious instruction to do so.
The reasoning is Cover, titlepage, jacket.
JSWolf is offline   Reply With Quote
Old 03-17-2023, 03:26 PM   #1745
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Where is that order being set in the book?
enuddleyarbl is offline   Reply With Quote
Old 03-17-2023, 03:36 PM   #1746
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by enuddleyarbl View Post
Where is that order being set in the book?
In the spine section of the OPF.
JSWolf is offline   Reply With Quote
Old 03-17-2023, 03:55 PM   #1747
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Except if I change the order in the spine so the jacket is in the 2nd position, Modify ePub puts it back (in some books) to the 3rd position. In most books, though, it'll put the jacket back into the 2nd position. There's got to be something, somewhere, that Modify ePub is seeing that tells it to move that file to some location regardless of what the spine says. But, darned if I can find it.
enuddleyarbl is offline   Reply With Quote
Old 03-17-2023, 04:10 PM   #1748
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by enuddleyarbl View Post
Except if I change the order in the spine so the jacket is in the 2nd position, Modify ePub puts it back (in some books) to the 3rd position. In most books, though, it'll put the jacket back into the 2nd position. There's got to be something, somewhere, that Modify ePub is seeing that tells it to move that file to some location regardless of what the spine says. But, darned if I can find it.
I don't know. I don't like jackets. I don't actually need it as the description is easily to pull up if I want it.
JSWolf is offline   Reply With Quote
Old 03-17-2023, 04:46 PM   #1749
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,559
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
FWIW: Modify has an option to put the 'jacket' at the back of the book. That option may have been added at my request, if not I certainly welcomed it.

BR
BetterRed is offline   Reply With Quote
Old 03-17-2023, 07:03 PM   #1750
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Just sticking various of Modify ePub's modules into Notepad++, I think I was able to find the issue. It looks like this is handled in add_replace_jacket and is_cover_or_title_id of jacket.py:
Code:
...
    # Next add it to the spine. We want it at the start of the book, but
    # after the Calibre titlepage and cover image.
    # TODO: Might want to make this a bit more bulletproof by looking at the guide etc.

    insert_pos = 1
    spine_items = list(container.get_spine_items())
    while insert_pos < len(spine_items):
        spine_id = spine_items[insert_pos].get('id').lower()
        if not is_cover_or_title_id(spine_id):
            break
        insert_pos += 1

    if jacket_end_book:
        insert_pos = -1
    container.add_to_spine(id, index=insert_pos)
    container.set(container.opf_name, container.opf)
    return True

def is_cover_or_title_id(spine_id):
    return spine_id.startswith('cvi') or spine_id.startswith('cover') or spine_id.startswith('titlepage') or spine_id.startswith('tp')
So, starting at the beginning of the spine, it starts looking for a place just after the Calibre cover and titlepage for the jacket. It defines those pages as ones with ids starting with "cvi", "cover", "titlepage" or "tp". And that last one seems to be the issue. Even though I change the name of the existing title page to "tpage.xhtml", I don't change the id in the manifest. So, whatever the author/publisher assigned it as an id is what's being checked. In this book's case, the id is "tp". So, Modify ePub goes right by it and inserts the jacket at the next position. It looks like most of the time, the id of that title page is NOT "tp" (or starting with tp -- for instance, in one of my multitude (usual) of books where the jacket gets put into the 2nd position, the tpage.xhtml file has an id of "title"). So, the jacket gets put just before that page instead of just after it.

I don't see how Modify ePub could change its behavior to handle all cases (it mentions a TODO of checking the guide -- but there IS no guide in this particular book), so it looks like the work-around (assuming this bothers me enough to do it) is to change the id of that tpage.xhtml file to something not starting in "tp" in both the manifest and the spine.

QED. At least I understand what I'm seeing, now.

Last edited by enuddleyarbl; 03-17-2023 at 08:49 PM. Reason: Why do I keep putting apostrophes where they don't belong?
enuddleyarbl is offline   Reply With Quote
Old 03-19-2023, 10:21 AM   #1751
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
@kiwidude: I've been pounding my head against a wall trying to set up VS Code to work with Calibre and plugins. I just found your Contributing page for your Github repository:

https://github.com/kiwidude68/calibr...ONTRIBUTING.md

and I'd like to thank you for that. That should help me tremendously in getting the environment set up.
enuddleyarbl is offline   Reply With Quote
Old 10-07-2023, 12:07 AM   #1752
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Modify ePub v1.8.2

Release Notes
https://github.com/kiwidude68/calibr...fy_epub-v1.8.2

An important fix in this one to handle badly named html files in the manifest such as with spaces/brackets in them. Somewhere along the way things got messed up (or maybe always broken), which meant if you did something like "Remove unmanifested files" then these poorly named files would get removed even though they do exist in the epub.
kiwidude is offline   Reply With Quote
Old 03-16-2024, 11:41 PM   #1753
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Modify ePub v1.8.3

Release Notes
https://github.com/kiwidude68/calibr...fy_epub-v1.8.3
kiwidude is offline   Reply With Quote
Reply

Tags
modify epub


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Quality Check kiwidude Plugins 1184 04-17-2024 06:17 PM
[GUI Plugin] Open With kiwidude Plugins 403 04-01-2024 08:39 AM
[GUI Plugin] Manage Series kiwidude Plugins 166 02-13-2024 11:31 AM
Modify ePub plugin dev thread kiwidude Development 346 09-02-2013 05:14 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 12:27 AM.


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