pgaskin / kobo-mods

My Kobo mods/hacks/tools which aren't patches and aren't in koboutils.
https://pgaskin.net/kobo-mods/
47 stars 7 forks source link

NickelSeries not importing subtitle #6

Open RodasQ opened 8 months ago

RodasQ commented 8 months ago

I installed NickelSeries on a Libra 2 running firmware version 4.38.21908, but after testing, the subtitle isn't passing without connecting a second time to the PC.

Keep in mind that I'm using the template "{#subseries} {#subseries_index}" for the subtitle on KoboTouchExtended. It works if I connect the Kobo a second time.

KoboTouchExtended is set to "update metadata on device" and "sending books to devices" set to "Automatic management"

pgaskin commented 8 months ago

I'm not completely familiar with how KTE works internally, but do note that the subtitle must be embedded in the EPUB with EPUB3/calibre-style metadata for NickelSeries to see it. Open one of the EPUBs from the KOBOeReader drive as a zip file, and see if it's in the package document (usually a .opf file) within.

pgaskin commented 8 months ago

From @jackiew1 on MR:

I don't use NickelSeries myself but I seem to remember, for Subtitle to be populated during the first USB connection, the subtitle text needs to exist in a calibre custom column with lookup name #subtitle. There was some discussion about it in the early parts of this thread.

RodasQ commented 8 months ago

Changed, and confirmed that still not works. But works after second

This info is embebed in the opf file

"#subtitle": { "#extra#": 2.0, "#value#": "Volume", "category_sort": "value", "colnum": 3, "column": "value", "datatype": "series", "display": { "description": "" }

lunaneff commented 1 week ago

It looks like calibre saves custom metadata for EPUB3 books in a different way compared to EPUB2, and the reading the code, it seems like that can only handle EPUB2 (or EPUB3 files with native subtitle metadata, which calibre can't write)

https://github.com/pgaskin/kobo-mods/blob/af10cc9d649ba95651f65b4d88b2bb41df0856d5/NickelSeries/metadata.cc#L150-L162

If I understand this code correctly, it's looking for a <meta name="calibre:user_metadata:#subtitle"/> element, with content roughly like this: (ignoring the properties it doesn't read) {"#value#": "subtitle goes here"}. Opening a random EPUB2 book I have, it matches that exactly, and NickelSeries properly imports the subtitle for this book

However, in an EPUB3 book, calibre saves custom columns like this:

<opf:meta property="calibre:user_metadata">{
  "#subtitle": {
    "#extra#": null,
    "#value#": "subtitle goes here",
    "category_sort": "value",
    "colnum": 7,
    "column": "value",
    "datatype": "text",
    "display": {
      "description": "",
      "use_decorations": false
    },
    "is_category": true,
    "is_csp": false,
    "is_custom": true,
    "is_editable": true,
    "is_multiple": null,
    "is_multiple2": {},
    "kind": "field",
    "label": "subtitle",
    "link_column": "value",
    "name": "Subtitle",
    "rec_index": 26,
    "search_terms": [
      "#subtitle"
    ],
    "table": "custom_column_7"
  }
}</opf:meta>

which is completely different from what the code expects, and thus it can't import the subtitle