mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Store book metadata and nb of pages in new settings
They may already be available (with other statistics stuff) under the 'stats' key, but not if Statistics plugin is disabled. As this plugin may be migrated to SQLite, readerui and readerfooter will now set two new properties: doc_props (containing all and only the metadata returned by document:getDocumentProps()) and doc_pages (updated by readerfooter on any display or font change). PDF document: returns additional PDF properties: Keywords and Subject (as Description).
This commit is contained in:
@@ -342,6 +342,16 @@ function ReaderUI:init()
|
||||
end
|
||||
self.postInitCallback = nil
|
||||
|
||||
-- Now that document is loaded, store book metadata in settings
|
||||
-- (so that filemanager can use it from sideCar file to display
|
||||
-- Book information).
|
||||
-- via pcall because picdocument:getProps() may fail
|
||||
local ok, doc_props = pcall(self.document.getProps, self.document)
|
||||
if not ok then
|
||||
doc_props = {}
|
||||
end
|
||||
self.doc_settings:saveSetting("doc_props", doc_props)
|
||||
|
||||
-- After initialisation notify that document is loaded and rendered
|
||||
-- CREngine only reports correct page count after rendering is done
|
||||
-- Need the same event for PDF document
|
||||
|
||||
Reference in New Issue
Block a user