baskerville / plato

Document reader
Other
1.26k stars 105 forks source link

Export bookmarks and annotations #370

Open rrrnld opened 1 month ago

rrrnld commented 1 month ago

Is there a way to export bookmarks or annotations? It looks like this should be scriptable, given how all the properties have serde annotations and will be serialized somehow, but I haven't found the files or any docs describing how to find them.

rrrnld commented 1 month ago

I found that this is stored in /.reading-state/$FINGERPRINT.json in a nicely readable JSON format (with full-text excerpts for the annotations). I'm not sure yet if there's an easy way to generate the fingerprint given an epub, which I think is calculated here: https://github.com/baskerville/plato/blob/7bb044c9ff1fbea1384a1fd12fc6f3ad045dc2d3/crates/core/src/helpers.rs#L108

EDIT They way to go seems to be via /.metadata.json, which contains entries like this, where the topmost property is the fingerprint.

{
  "53514746012C0011": {
    "title": "Ways of Being",
    "author": "James Bridle",
    "year": "2023",
    "language": "en",
    "publisher": "Penguin Books Ltd",
    "file": {
      "path": "Bridle, James/Ways of Being - James Bridle.epub",
      "kind": "epub",
      "size": 19660817
    },
    "added": "2024-04-17 17:43:54"
  }
}
ABeehive commented 1 month ago

Thanks @heyarne!, this gave me the idea to write this script :

https://github.com/ABeehive/PlatoHighlights2Readwise

Which works for me!