Update screensaver.lua

reviewable/pr11541/r3
SomeGuy 3 months ago committed by GitHub
parent d11dd6365f
commit ba2c21cb18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -148,7 +148,11 @@ function Screensaver:expandSpecial(message, fallback)
time_left_chapter = self:_calcAverageTimeForPages(ui.toc:getChapterPagesLeft(currentpage) or doc:getTotalPagesLeft(currentpage))
time_left_document = self:_calcAverageTimeForPages(doc:getTotalPagesLeft(currentpage))
end
percent = math.min( Math.round((currentpage * 100) / totalpages), 99)
if currentpage == totalpages then
percent = 100
else
percent = math.min( Math.round((currentpage * 100) / totalpages), 99)
end
props = ui.doc_props
elseif DocSettings:hasSidecarFile(lastfile) then
-- If there's no ReaderUI instance, but the file has sidecar data, use that
@ -156,7 +160,11 @@ function Screensaver:expandSpecial(message, fallback)
totalpages = doc_settings:readSetting("doc_pages") or totalpages
percent = doc_settings:readSetting("percent_finished") or percent
currentpage = Math.round(percent * totalpages)
percent = math.min( Math.round(percent * 100), 99)
if currentpage == totalpages then
percent = 100
else
percent = math.min( Math.round(percent * 100), 99)
end
props = FileManagerBookInfo.extendProps(doc_settings:readSetting("doc_props"), lastfile)
-- Unable to set time_left_chapter and time_left_document without ReaderUI, so leave N/A
end

Loading…
Cancel
Save