Skip to content

Instantly share code, notes, and snippets.

@dmalinovsky
Created April 2, 2024 23:02
Show Gist options
  • Save dmalinovsky/69fd68af7848008b1cc80a76961f2d77 to your computer and use it in GitHub Desktop.
Save dmalinovsky/69fd68af7848008b1cc80a76961f2d77 to your computer and use it in GitHub Desktop.
Patch for KOReader to build logical page count
local ReaderPageMap = require("apps/reader/modules/readerpagemap")
local postInit_orig = ReaderPageMap._postInit
ReaderPageMap._postInit = function(self)
self.ui.document:buildSyntheticPageMapIfNoneDocumentProvided(1818)
-- Run original code
postInit_orig(self)
end
@dmalinovsky
Copy link
Author

I think it should be possible to fill in the reference pages in bulk with Calibre. And then KOReader should use them.

I can fill the reference pages in bulk and download the books via opsd (I think the metadata is embedded in the process). But how can I tell KOReader to USE that value? Let's say I have it stored it a custom field in calibre named as "#k_pages"

It doesn't work like that, but it's possible to pass reference pages from Calibrea to KOReader: koreader/koreader#13869. Note that there was a bug in Calibre recently breaking this.

And is it possible to apply the logical pages in other places? I have noticed the "Book Information" panel now doesn't use that value. "Alternative status bar" doesn't use it either.

This is up to the devs. Reading stats also don't support it: koreader/koreader#13345

Maybe I'll take a look some day but it's not a priority for me.

@dmalinovsky
Copy link
Author

This gist will be superseded by koreader/koreader#14405.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment