Skip to content

[Calibre] preserve uuid field in calibre metadata serialisation#15088

Merged
Frenzie merged 1 commit into
koreader:masterfrom
Commodore64user:calibre
Mar 8, 2026
Merged

[Calibre] preserve uuid field in calibre metadata serialisation#15088
Frenzie merged 1 commit into
koreader:masterfrom
Commodore64user:calibre

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Mar 8, 2026

Copy link
Copy Markdown
Member

bug fix

In slim(), fields without explicit handling fall through to a bare slim_book[k] = book[k] assignment. In Lua, assigning nil to a table key removes it entirely, so any book with a missing uuid produces a JSON payload with no field at all.
Calibre's Smart Device driver expects the uuid to be present on every book so a single missing one raises a KeyError

calibre, version 9.4.0
ERROR: Error: Error communicating with device

'uuid'

Traceback (most recent call last):
  File "calibre/gui2/device.py", line 110, in run
  File "calibre/gui2/device.py", line 581, in _books
  File "calibre/devices/smart_device_app/driver.py", line 58, in _synchronizer
  File "calibre/devices/smart_device_app/driver.py", line 1316, in books
KeyError: 'uuid'

and aborts the entire book enumeration. The connection succeeds and file transfer works, but the library appears empty on the calibre side.

  • Fixed by handling uuid consistently with series and series_index, falling back to rapidjson.null rather than silently dropping the key.

This change is Reviewable

@Frenzie Frenzie added this to the 2026.02 milestone Mar 8, 2026
@Frenzie Frenzie merged commit 33654af into koreader:master Mar 8, 2026
4 checks passed
@Commodore64user Commodore64user deleted the calibre branch March 8, 2026 12:32
@Commodore64user

Copy link
Copy Markdown
Member Author

a bit late now but @pazos, can you have a look?

@Commodore64user

Commodore64user commented Mar 8, 2026

Copy link
Copy Markdown
Member Author

I also just realised that block could just be

    if k == "tags" or k == "authors" then
        slim_book[k] = book[k] or rapidjson.array({})
    else
        slim_book[k] = book[k] or rapidjson.null
    end

@Frenzie

Frenzie commented Mar 8, 2026

Copy link
Copy Markdown
Member

Yes, the diff hid the context.

@Commodore64user

Copy link
Copy Markdown
Member Author

fixed in #15094

Frenzie pushed a commit that referenced this pull request Mar 8, 2026
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…ader#15088)

Otherwise calibre wil raise an error when its nil:

```
calibre, version 9.4.0
ERROR: Error: Error communicating with device

'uuid'

Traceback (most recent call last):
  File "calibre/gui2/device.py", line 110, in run
  File "calibre/gui2/device.py", line 581, in _books
  File "calibre/devices/smart_device_app/driver.py", line 58, in _synchronizer
  File "calibre/devices/smart_device_app/driver.py", line 1316, in books
KeyError: 'uuid'
```
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants