readstor icon indicating copy to clipboard operation
readstor copied to clipboard

Linear sort of location field

Open bf4648 opened this issue 1 year ago • 3 comments

First of all, I want to say, I love this open-source project! Thank you so much for making it. I do have some recommendations for some enhancements though.

  • I would like the option to export just one book's highlights, instead of exporting all the iBook highlights at once.
  • I would also like to export iBook highlights in a linear way. This way I can gradually export my highlights to other software for processing.

This is currently the way I export my iBook highlights:

  1. I use readstor to export all iBook highlights to a directory (it would be nice to just add an "-id" parameter so that I do not have to export all my iBook highlights):
rm -rf /tmp/workspace
mkdir -p /tmp/workspace
readstor -f -o /tmp/workspace/ export --extract-tags
  1. I then sort by the 'location' field (since I want my highlights sorted linearly):
cat annotations.json | jq 'map(.metadata.location |= {sortkey: [splits("[.:]") | tonumber], value: .}) |
  sort_by(.metadata.location.sortkey) |map(.metadata.location |= .value)' > annotations-sorted.json

I then have to figure out a way to transform this "annotations-sorted.json" file into a markdown format. It would be nice to just add a '--sort' parameter to readstor export or readstor render. It would especially be helpful to add a --sort parameter to the readstor render command since this already exports to markdown format.

bf4648 avatar Nov 28 '22 16:11 bf4648