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

Skip hidden flows (non-linear fragments) in the progress bar #10

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

liskin
Copy link
Contributor

@liskin liskin commented Nov 17, 2023

A user reported that when reading a book with hidden flows (non-linear fragments), the progress bar on PocketBook home screen never reaches 100% - https://www.mobileread.com/forums/showpost.php?p=4371306&postcount=30

To solve this, instead of using the total number of pages, we use the number of pages in the main flow (actually, current flow, and if that is not the main one, we skip the sync completely).

The implementation is inspired by https://github.com/koreader/koreader/blob/2e2ca76a03ba255764bb9b8e6cc81a4bd501a3b3/plugins/statistics.koplugin/main.lua#L1620-L1630
Note that we don't need to check hasHiddenFlows as the flow-aware methods of CreDocument handle flow-less documents as well.

os.time() without arguments already returns seconds since epoch.
@liskin
Copy link
Contributor Author

liskin commented Nov 17, 2023

Tested with test1.epub.zip, which is https://github.com/w3c/epub-tests/tree/main/tests/pkg-spine-nonlinear-activation just with additional lorem ipsum pages to make the progress bar meaningful.

liskin added 2 commits May 4, 2024 15:30
A user reported that when reading a book with hidden flows (non-linear
fragments), the progress bar on PocketBook home screen never reaches
100% - https://www.mobileread.com/forums/showpost.php?p=4371306&postcount=30

To solve this, instead of using the total number of pages, we use the
number of pages in the main flow (actually, current flow, and if that is
not the main one, we skip the sync completely).

The implementation is inspired by
https://github.com/koreader/koreader/blob/2e2ca76a03ba255764bb9b8e6cc81a4bd501a3b3/plugins/statistics.koplugin/main.lua#L1620-L1630
Note that we don't need to check hasHiddenFlows as the flow-aware
methods of CreDocument handle flow-less documents as well.
PBReader does this as well so PocketBook users expect this behaviour.

To be more precise, PBReader's logic is a bit more complex than this. It
hides the progress bar not just for the first (cover) page, but also
seems to hide it for the preamble content like copyright, table of
contents, etc. I suspect it just hides everything until the first page
that

    <guide><reference type="text" … /></guide>

refers to. This commit doesn't implement that, and hopefully people
won't request it.

Additionally, PBReader seems to remap the page numbers: since the first
page becomes 0 to hide the progress bar, and the last page stays the
same, the range has an extra page. The exact formula used is unknown,
but in practice it just ends up skipping a page number at the end of the
range (one can't do better than that if the input is an integer).

I believe it's better to skip a page number at the beginning, as there
actually exists a page that can be considered read—the cover page—we
just never show a progress bar saying that only one page is read.
Implementing this is also much easier.

Fixes: https://www.mobileread.com/forums/showthread.php?p=4373638#post4373638
@liskin
Copy link
Contributor Author

liskin commented May 4, 2024

@ckilb Hey, I just pushed another small commit that addresses some user feedback. The rest of the code has worked flawlessly for months.

And there's that another PR that I've been happily running on my device and that received positive feedback from users on that MobileRead forum thread as well. I'm wondering if you perhaps need help maintaining this?

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 this pull request may close these issues.

None yet

1 participant