out-of-cheese-error / gooseberry

A command line utility to generate a knowledge base from Hypothesis annotations
Apache License 2.0
152 stars 9 forks source link

Link local PDF annotations to filename #67

Open Ninjani opened 3 years ago

Ninjani commented 3 years ago

Problem

Local PDF annotations have urn:x-pdf:<fingerprint> as their URI, which says nothing about the filename or where it's stored. Would be nice to have the filename to link to the file in local knowledge base systems.

Solution

Have a PDF folder set in the config, keep a mapping of all PDF fingerprints for this folder (using this post as reference), and map all PDF annotations to their respective files using this mapping.

Alternatives

Ideally should have a reverse mapping function so that you don't need a PDF folder, but I doubt this is possible.

Additional context

Needs a file-watcher aspect to check if PDF files in the folder have been added / updated. The first version could just loop through the PDF folder on every sync.