koreader-calibre-plugin
koreader-calibre-plugin copied to clipboard
[FEATURE] Sidecar location support?
Feature Summary
Add support for different sidecar locations
Motivation
KOReader lets users choose where to save sidecar directories. If those aren't next to the books themselves, the plugin fails completely. Can you consider adding support for having sidecar in different places?
Use Cases
Choosing different location to save sidecar directories
Alternatives
No response
Additional Context
No response
but does the koreader support sidecar with different location of the book? if so how you link book with sidecar in ../a/b/c/d/etc ?
Not sure if I understand your question; I refer to this setting: Wheel icon - Document - Book metadata location. There's the book folder, docsettings, and hashdocsettings options.
oh I got it. so there koreader support for that.
the question is: does calibre driver supports multiple paths (this need to be investigated and tested) from plugin side we do not care about the lua file location after changing location we just not getting any data (seems like) so the book is skipped and I don't see any failures so
the plugin fails completely is not exactly accurate
I had a brief look at how to implement this, and there is one issue that I found. The md5 hash is calculated by reading the file's contents. This allows things like file location or name changes etc to produce the same hash. https://github.com/koreader/koreader/blob/8f71c00440df8a76367325d75c05e541f2b048cd/frontend/util.lua#L1102-L1119
The issue is, that doing the same in python might be tricky. The current implementation is "naive" and just looks for a similarly named .sdr file, but when using hashdocsettings, you must know the hash of the file before hand.
I think a nice solution would be to write a companion koreader plugin that writes out a json file containing file paths and their hashes/sdr location. And then this plugin can just read that file. This means that this plugin doesn't care about the setting at all. It's this koreader plugin's responsibility to ensure that the file contents are accurate.
@kyxap would
05/19/25-18:58:06 DEBUG CalibreMetadata:initSidecarMap {
["c3095f1c-fe01-452c-9556-dfe187e5c95a"] = "Books/ONE/One-Punch man/One-Punch Man, Vol. 1 - ONE (26).sdr"
} --[[table: 0x7f16b43a3148]]
work?
It's a map of calibre uuid and koreader sdr location that can be saved as json to disk and then this plugin would read it 🤔.
@kyxap Heads up — the upstream MR is currently blocked, pending a response to my question above. Would you be open to accepting the proposed solution of storing a JSON file with the mapping?