Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with "left pages number" #11561

Closed
ghost opened this issue Mar 17, 2024 · 4 comments · Fixed by #11873
Closed

Issue with "left pages number" #11561

ghost opened this issue Mar 17, 2024 · 4 comments · Fixed by #11873
Milestone

Comments

@ghost
Copy link

ghost commented Mar 17, 2024

  • KOReader version: 2024.03.1 (Latest)
  • Device: PocketBook 633 Color

I enabled the function to show only as many pages as in the physical book.

And I ran into this problem:
In the status bar it shows the same on different indicators, that is, it shows only one thing correctly - the current page in the book.

And the same number is shown in “how many pages are left until the end of the book”, although there should be a different number, a different indicator.

I hope I explained clearly...

The photo shows and makes it clear what the problem is (circled in red)

IMG_20240317_123531.jpg

How to fix this problem? Can you help me?
Please fix it!!!

I adore KOReader!

@poire-z
Copy link
Contributor

poire-z commented Mar 17, 2024

I enabled the function to show only as many pages as in the physical book.

I think you mean Reference pages > Use reference page numbers.

And indeed, when this is enabled, both items show the same thing:

page_progress = function(footer)
if footer.pageno then
if footer.ui.pagemap and footer.ui.pagemap:wantsPageLabels() then
-- (Page labels might not be numbers)
return ("%s / %s"):format(footer.ui.pagemap:getCurrentPageLabel(true),
footer.ui.pagemap:getLastPageLabel(true))
end

pages_left_book = function(footer)
local symbol_type = footer.settings.item_prefix
local prefix = symbol_prefix[symbol_type].pages_left_book
if footer.pageno then
if footer.ui.pagemap and footer.ui.pagemap:wantsPageLabels() then
-- (Page labels might not be numbers)
return ("%s %s / %s"):format(prefix,
footer.ui.pagemap:getCurrentPageLabel(true),
footer.ui.pagemap:getLastPageLabel(true))
end

The reason being that, even if this may be rare, (Page labels might not be numbers), that is: they are just strings, they can be roman numerals, ie. you could get as current page: xxviii / 243 - and we can't assume we can do the substraction, or that a substraction will give the right number of pages left in book.

Dunno if we should show something different for this when pagemap:wantsPageLabels().

@Commodore64user
Copy link
Contributor

The reason being that, even if this may be rare, (Page labels might not be numbers), that is: they are just strings, they can be roman numerals, ie. you could get as current page: xxviii / 243 - and we can't assume we can do the substraction, or that a substraction will give the right number of pages left in book.

What if you parse the string? If it is an integer you convert it to such and perform the arithmetic, if not then just display the label/string, i.e xxviii / 243 or even just xxviii.

@poire-z
Copy link
Contributor

poire-z commented May 9, 2024

It might give the right result in most books - but it's possible it doesn't: current and last pagelabels may be string that resolve to numbers, but it's possible they don't relate, one being in a counting sequence, the last one in another.
The right thing to do, that would work in all cases and give a more proper account of pages left, is probably to count the number of page label slots or use the index in that array of page labels, and substract these.
(I think I mentionned something like that in another issue related to "reference pages", maybe something about getting them for the top status bar.)

@Commodore64user
Copy link
Contributor

just thinking out loud here, but I was also thinking, maybe one could use the last integer found in the array as the last page, so if you have something like page_array = {i ,ii, iii, iv, 1, 2, 3, 4, 5, v, vi, vii} you would say you are in page 1/5 and there are 5-1 pages missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants