foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
2.87k stars 305 forks source link

[Feature Request] Option to use calibre-bookmarks.txt for current reading location #1111

Open DrymarchonShaun opened 1 year ago

DrymarchonShaun commented 1 year ago

In epub files Calibre uses a last-read entry in META-INF/calibre-bookmarks.txt to save reading location.

for whatever reason its encoded as base64 -- (Example)

encoding=json+base64:
W3sicG9zIjogImVwdWJjZmkoLzE0LzIvNFsyUkhNMC1iMDU4YzQ2NzM5MDk0ZTU0YmY0NjRkZTc2NmIw
NTY2NF0vMltjaGFwdGVyLTFdLzRbY2hhcHRlci0xLXRleHRdLzYvMToxNTcpIiwgInBvc190eXBlIjog
ImVwdWJjZmkiLCAidGltZXN0YW1wIjogIjIwMjMtMDUtMDJUMDU6MzM6MDkuMzQzODc1KzAwOjAwIiwg
InR5cGUiOiAibGFzdC1yZWFkIn1d

decoded it becomes --

[{"pos": "epubcfi(/14/2/4[2RHM0-b058c46739094e54bf464de766b05664]/2[chapter-1]/4[chapter-1-text]/6/1:157)", "pos_type": "epubcfi", "timestamp": "2023-05-02T05:33:09.343875+00:00", "type": "last-read"}]

Is it feasible to add the ability to use this file for current reading position? As it is now there is no way to sync reading position between Calibre and Librera, in theory this would make it possible with something like Syncthing.

chemicalcain commented 1 year ago

It might be useful context for this to know how Librera currently handles Bookmarks. I wonder if the files could be made cross-compatible somehow. Librera stores Bookmarks and Quick Bookmarks in "app-Bookmarks.json". Here's one bookmark line for reference.

"1694142910667":{"isF":false,"p":0.36120403,"path":"/storage/3132-3733/Books/Fiction/Crooked_House.epub","t":1694142910667,"text":"Quick Bookmark"}

Also notable: Librera's bookmark function anchors to "page" rather than paragraph. I suspect this means bookmarks in Librera are not currently compatible with Calibre even if they were run through an encoder, because different screens will have different text on the 50th page of a file. See issue #1144 to discuss bookmark anchoring.

chemicalcain commented 1 year ago

"app-Progress.json" seems to use the same file structure as "app-Bookmarks.json". Here's an example of the same book file and position as the quick bookmark I posted before. From app-Progress.json "Crooked_House.epub":{"cp":false,"d":0,"dc":false,"dp":false,"lk":1,"p":0.36120403,"s":120,"sp":false,"t":1694142906650,"x":0,"y":0,"z":100}

d3rpd3rpd3rp commented 2 months ago

Just adding that it would be fantastic to have more Calibre integration in Librera, I suspect that most serious ebook readers use it to organize and manage their libraries.