From f37f66c58b0a219338c6bad7bd96e551af739858 Mon Sep 17 00:00:00 2001 From: AndyHazz <517731+AndyHazz@users.noreply.github.com> Date: Sun, 17 May 2026 09:19:56 +0100 Subject: [PATCH] plugins/calibre: preserve author_sort in slim metadata (#15398) Calibre's author_sort field carries the curated "Surname, Forename" form for each author -- distinct from the display string in authors, and the only reliable way to get surname-ordering right for compound names, particles, and inverted-naming cultures (CJK, Hungarian). slim() currently strips this field when writing the device-side .metadata.calibre after a wireless transfer, even when desktop Calibre includes it in the transfer payload. Downstream plugins that want correct surname ordering can't get at it for libraries synced via the Calibre Companion plugin -- reported in the Bookshelf koplugin issue tracker by a user with ~2250 books all showing empty author_sort after sync, despite their desktop Calibre having the field populated on every book. Add "author_sort" to the used_metadata whitelist so it's preserved on the device-side file. Books without the field continue to load cleanly (slim's "or rapidjson.null" handles missing fields); on-disk size grows by a small per-book constant. search_used_metadata stays unchanged -- search displays the author string, not the sort form. --- plugins/calibre.koplugin/metadata.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/calibre.koplugin/metadata.lua b/plugins/calibre.koplugin/metadata.lua index 651dd76ac..714c81d27 100644 --- a/plugins/calibre.koplugin/metadata.lua +++ b/plugins/calibre.koplugin/metadata.lua @@ -21,6 +21,7 @@ local used_metadata = { "size", "title", "authors", + "author_sort", "tags", "series", "series_index"