janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
13.03k stars 1.39k forks source link

Sync book reading progress on Kobo #2036

Open Justalurker1213 opened 3 years ago

Justalurker1213 commented 3 years ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like It would be awesome to have calibre-web store reading progress (percentage read) from kobo devices in the database. I'm not sure if it's possible but if this was implemented it would be nice to then sync this information to Goodreads as well.

Describe alternatives you've considered Currently, I sync percentage read with the main calibre program using the Kobo Utilities plugin. I also use the Goodreads plugin to sync reading progress to Goodreads.

Additional context None

OzzieIsaacs commented 3 years ago

If you are using the kobo sync mechanism, this already should work (except for the goodreads part). There is one limitation (from kobo side): For epubs the progress is only stored chaperter wise. To have full compatibility you need to sync kepub files (can be generated using kepubify). I will not put any more work into the goodreads extension, as goodreads suspended it's api service for new registrations, so only already registered users can use their api. I'm not sure about the future of this part of the project. Sorry

Justalurker1213 commented 3 years ago

Is there any documentation explaining how the read progress sync works? I'm using kepubs, I just can't find where it's storing the progress.

arunoruto commented 3 years ago

I am also currently interested in finding a way to save my reading progress in some way. KEPUB has some additional elements with spans containing ids (which are unique in each chapter, so you need the chapter and id to know where you currently are). That should be saved somewhere and should be somehow convertible to a percentage (see here for the kepub - epub relation).

I also found out that there is a last_read_positions table present in the metadata.db with the columns: Name Format
book int
format text
user text
device text
cfi text
epoch real
pos_frac real

It could be used to also save the synced kepub information? Or is there a reason for it not being used?

EDIT I went through the Kobo code and found out the section, where the reading status is being synced. It happens at this endpoint, while here the values are being read or created. Seems like the app database is being used to store the Kobo stuff, which you can find in /config/app.db (I use sqliteonline to inspect the content of the database). It references the IDs present in the metadata.db.

jeff47 commented 2 years ago

If you are using the kobo sync mechanism, this already should work (except for the goodreads part).

This doesn't seem to "just work" for me. I use a Kobo Libra H20 for my reading, with Kepubs. I use kobo sync with Calibre Web. But I'm not seeing any reading progress reflected in the book metadata, or in calibre. Am I looking in the wrong place? Do I need to create custom columns in calibre? I have a vague recollection of that...

I would love to be able to have Calibre-Web be able to mark when I've completed a book as well as my progress.

Antetokounpo commented 2 years ago

The progress information for Kobo is stored in app.db. There are a couple tables prefixed with kobo_, but the ones of interest are kobo_reading_state and kobo_bookmark.

You can use the kobo_reading_state to look up an id for a given book_id and then use this id to check for a bookmark in kobo_bookmark. The location_source will give you the HTML file in which the bookmark is located (from what I understand EPUB and KEPUB are just archives with a bunch of HTML files). location_value will give you the line you're currently at. Its value should look something like kobo.206.1 (at least for KEPUB files from what I've seen) and it's the id of a <span> in the HTML file.

This table could be used to sync the reading progress. Although, you would need a way to convert the KEPUB location to a EPUB location or a PDF location for example if you wish to continue your reading in the browser from the Kobo and vice-versa. Also, I got this information from messing around, so my assumptions about certain things might be wrong.

0x90shell commented 5 days ago

My epubs convert to Kobo epubs on sync, but the progress sync always moves read positions back to chapter not exact page.