book reading statistics for djvu documents

This commit is contained in:
chrox
2016-07-15 22:58:41 +08:00
parent d4c31d683f
commit 1d887f4fe1
5 changed files with 14 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ local ReaderStatus = InputContainer:new {
}
function ReaderStatus:init()
if self.ui.document.is_djvu or self.ui.document.is_pic then
if self.ui.document.is_pic then
self.enabled = false
return
else

View File

@@ -155,10 +155,6 @@ function CreDocument:getCoverPageImage()
end
end
function Document:getProps()
return self._document:getDocumentProps()
end
function CreDocument:getWordFromPosition(pos)
local word_box = self._document:getWordFromPosition(pos.x, pos.y)
DEBUG("CreDocument: get word box", word_box)

View File

@@ -41,6 +41,14 @@ function DjvuDocument:init()
self:_readMetadata()
end
function DjvuDocument:getProps()
local _, _, docname = self.file:find(".*/(.*)")
docname = docname or self.file
return {
title = docname:match("(.*)%.")
}
end
function DjvuDocument:getPageTextBoxes(pageno)
return self._document:getPageText(pageno)
end

View File

@@ -144,6 +144,10 @@ function Document:getNativePageDimensions(pageno)
return page_size
end
function Document:getProps()
return self._document:getDocumentProps()
end
function Document:_readMetadata()
self.mod_time = lfs.attributes(self.file, "modification")
self.info.number_of_pages = self._document:getPages()

View File

@@ -38,7 +38,7 @@ local ReaderStatistics = InputContainer:new {
}
function ReaderStatistics:init()
if self.ui.document.is_djvu or self.ui.document.is_pic then
if self.ui.document.is_pic then
return
end