tnahs / readstor

A CLI for Apple Books annotations
https://tnahs.github.io/readstor/
Apache License 2.0
16 stars 1 forks source link

Additional book metadata fields #8

Open xaviergosselin opened 1 year ago

xaviergosselin commented 1 year ago

This is a very useful tool to export books and annotations. At the moment, book metadata only has two entries - "id" and "last opened date". Looking at the ZBKLIBRARYASSET structure there are a lot of other fields that could be valuable to also export as metadata. The one I'm personally looking for is ZDATEFINISHED (for structuring the annotations directories when exporting), but I would see value in the following as well:

I've bolded the ones currently in the book metadata fields. Another nice-to-have is a ZBKCOLLECTION lookup to have books tagged with their collection.

tnahs commented 1 year ago

Hey! Thanks for submitting an issue and I'm glad you find this useful! :smile:

This seems like a great addition. I must have overlooked these fields when looking through the database. Although I recall, many of the ones I omitted were blank. So I'm not sure how/when these fields get populated.

There is only one thing holding this back (and the release of v0.6) is that Apple Books for iOS doesn't seems to have all the same fields available for Book assets. I'm specifically trying to find the equivalent to ZLASTOPENDATE.

I'll have to take a second look and follow up on this. This change should be rather trivial. The only consideration would be how to handle fields missing between Apple Books for iOS and macOS.

RE: ZBKCOLLECTION. I remember implementing this a while back in a previous version of this tool but dropped for some reason. This change will prob take a bit more time to implement but I think it will be a good (re-)addition!

xaviergosselin commented 1 year ago

I did dig into this a bit more and found that for the books I have al to of these fields are indeed empty (or mostly) - must be based on the book source (manually adding an EPUB to library vs purchasing vs renting?). Mostly populated are related to status (ZISFINISHED and ZNOTFINISHED, ZCREATIONDATE and ZDATEFINISHED). I'm not looking at the iOS version of these databases; a bit unnerving to not see the data structures match

The usecase I'm considering here (also related to ZBKCOLLECTION) is more of a static, syncable book collection library alongside the annotations. The ./readstore data (by the way, I could not find a way to change this save directory within the API?) is really what becomes syncable. The formatting & templating of annotations is part 2!

Great little project. Thanks!

tnahs commented 1 year ago

I could not find a way to change this save directory within the API?

https://tnahs.github.io/readstor/latest/00-intro/02-01-global.html#--output-directory-path

Is that what you mean?

The usecase I'm considering here (also related to ZBKCOLLECTION) is more of a static, syncable book collection library alongside the annotations.

This was my use case, I wanted to read a book, annotate it, archive it in a directory with the epub and finally remove it from Apple Books cause it's a pain to migrate a library after a fresh install. (Hence all the documentation in this repo)

Also, I'll try to get to adding these extra field in the coming weeks. I don't have as much free time to devote to this at the moment but will def implement as much of this as I can!