Skip to main content

Script to embed zotero database highlights to sioyek pdf reader database.

Project description

Zotero to Sioyek Highlights Manager


Python script to embed zotero highlights to sioyek, and other utils.

updatebadge pypibadge mitbadge

emailbadge

📖 Contents

✨ Features

  • Embed zotero highlights to the sioyek database:
python zot2sioyek.py --insert-highlights "/path/to/file.pdf"
  • Print in terminal the text of all the highlights from a zotero file, colored with the highlight color
python zot2sioyek.py --print-annotation-text "/path/to/file.pdf"
  • To see all available commands:
python zot2sioyek.py --help

📚 Requirements

Requirements are automatic installed when this script is installed with pip

  • pyzotero

  • pymupdf

  • PyQt5

  • regex

  • sqlite3

python -m pip install pyzotero pymupdf PyQt5 regex sqlite3

🐍 Conda

If wanted, requirements may be installed with conda, to run this script in a conda environment.

Inside this repo, run:

conda env create --file env.yml

📦 Installation

python -m pip install zot2sioyek

🔧 Configuration

To use this script define the variables in zot2sioyek.py:

  • SIOYEK_PATH: Sioyek binary path.

  • LOCAL_DATABASE_FILE_PATH: Sioyek .db local database file path.

  • SHARED_DATABASE_FILE_PATH: Sioyek .db shared database file path.

  • ZOTERO_LIBRARY_ID: Your personal library ID available Here, in the section Your userID for use in API calls.

  • ZOTERO_API_KEY: Api key, you can obtain Here.

  • ZOTERO_LIBRARY_TYPE: Zotero library type, can be 'user' or 'group'.

  • ZOTERO_LOCAL_DIR: Zotero local storage folder, like /home/user/Zotero/storage.

  • ZOTERO_TO_SIOYEK_COLORS: Sioyek highlight type letter associated to each zotero highlight color (Optional).

🎨 Colors

  • This script defines ZOTERO_TO_SIOYEK_COLORS variable based on the most close colors of default sioyek config, to the zotero highlight colors. The conversion looks like the following (Zotero colors in the upper row, sioyek colors in the lower row):

comparison colors

  • If you want to have the exact same colors of zotero highlights in sioyek, add the following to your sioyek prefs_user.config:
highlight_color_g 0.37 0.70 0.21
highlight_color_a 0.63 0.54 0.90
highlight_color_p 0.90 0.43 0.93
highlight_color_b 0.18 0.66 0.90
highlight_color_r 1.00 0.40 0.40
highlight_color_o 0.95 0.60 0.22
highlight_color_y 1.00 0.83 0.00
  • Or to any highlight letter you want, since the defined letter on prefs_user.config and the script variable ZOTERO_TO_SIOYEK_COLORS match.

📝 TODO

  • Embed all zotero database highlights starting from a specified date.

  • Create import from sioyek database to zotero database highlights.

    • Currently, I couldn't find a way of adding zotero highlights through pyzotero, or through zotero api/sql. If anyone knows how to do it, please message or email me so that I can update this script, or feel free to implement the needed updates and send a pull request, I'll be very thankful.

🤝 Contributing

Feel free to make pending or other optimizations and pull requests, this script is still under development and any contribution is very much appreciated.

  • Clone the repo to your local environment:

💓 Aknowledgements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zot2sioyek-0.1.6.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

zot2sioyek-0.1.6-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file zot2sioyek-0.1.6.tar.gz.

File metadata

  • Download URL: zot2sioyek-0.1.6.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for zot2sioyek-0.1.6.tar.gz
Algorithm Hash digest
SHA256 5a3920a9d4d09ddc3ae7c44f3606f462f6a664980422b6313e0192f98af0c0a3
MD5 0d030c046df54b384cdc133cb2715cef
BLAKE2b-256 92e952ab6a2bcc75f920984dc25d5f409f778b89f618677cac242a5924f0da7c

See more details on using hashes here.

File details

Details for the file zot2sioyek-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: zot2sioyek-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for zot2sioyek-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 07bcca45a8e697a5cf22f0c21be5793c4ce712c65432d803713af3e60bcb7060
MD5 5bec35545971dc6da6ff5b2078963be6
BLAKE2b-256 7ec74fbdfa994ef7480fc60ee604ea0533b4b57fd60c9165b4214859ea62b884

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page