buckley-w-david / plato-calibre

Plato hook to download/sync books from calibre
MIT License
1 stars 0 forks source link

Better update ergonomics #13

Open buckley-w-david opened 2 years ago

buckley-w-david commented 2 years ago

When a book is updated, the reading progress is wiped out.

This is likely due to the implementation of updateDocument I wrote for plato as opposed to anything with plato-calibre

I should attempt to keep reading progress. There is an awkward situation where the number of chapters after an update can actually go down if a story removes a bunch of chapters (Like they have to after cutting a book for kindle unlimited). This means we probably can't do something as simple as copying over the previous reading progress and expecting it to work. Might be best to just try that and if it's past the end of the book reset to the start.

buckley-w-david commented 2 years ago

Looked into this a bit more.

This information is stored in the reader field of the info struct, which is sent to us from the search.

Unfortunately even if we extract it from the search results and pass it on with our update, it won't work.

pub struct Info {
    ....
    #[serde(skip)]
    pub reader: Option<ReaderInfo>,
    #[serde(skip_serializing_if = "Option::is_none", skip_deserializing)]
    pub _reader: Option<ReaderInfo>,
    ...
}

_reader or reader is what we'd be targeting, not sure which, but regardless neither of them are set to deserialize, so even if we pass the info along it will just be thrown away.

I'd have to start mucking about with the info definition to get it to work, and that's getting farther into the internals of plato than I wanted to change.