AndreasSko / go-jwlm

A command line tool to easily merge JW Library backups, written in Go.
MIT License
73 stars 4 forks source link

Use catalog.db for better insights into publications when merging #16

Open AndreasSko opened 4 years ago

AndreasSko commented 4 years ago

Sometimes it can be hard to figure out what publication a bookmark or marking belongs to when only looking at the KeySymbol or DocumentID. We could benefit from the catalog that JWLibrary is using to show all available publications.

Proposed approach: Create an additional package that is responsible for looking up the publication a KeySymbol or DocumentID is belonging to. We are able to use API for that:

  1. Fetch the current manifest from https://app.jw-cdn.org/catalogs/publications/v4/manifest.json
  2. Download the current catalog from https://app.jw-cdn.org/catalogs/publications/v4/{MANIFEST}/catalog.db.gz
  3. Cache it locally and only fetch it again if we are not able to lookup a publication (because it may be too new)
  4. Query the DB for the KeySymbol or DocumentID (using the PublicationDocument table).
abdon-copper commented 3 years ago

Nice, that would indeed be useful. One thing I ran into with a related project was that MepsLanguage is just a number and not a user friendly representation of the language. catalog.db also contains a table for languages.

AndreasSko commented 3 years ago

This has been implemented for the JWLM app. Still open for the command line though.

temporarium commented 2 years ago

You may be interested in a similar project here: https://gitlab.com/erykj/jwlmanager Multi-platform and GUI