Skip to main content

A high customized dictionary

Project description

https://api.travis-ci.com/PixelHegel/NotionDict.svg?branch=main

NotionDict

NotionDict is a terminal dictionary application, you can use it to query the words from your own .mdx files,and the result will be shown by system notification. And it also supports uploading the result to Notion. You also can use it to upload highlight text to Notion. The best practice is to bind a shortcut to the app, then you can easily query the dict and highlight text anywhere.

What NotionDict can do?

  1. Query the selected word and show the result by system notification, at the same time, the word will be saved to your Notion database.

doc/notification.png
  1. Highlight the selected text, and sync the selected text to your Notion database, the title of the acitve window will be sent to Notion as well. So you can get the highlight text of one pdf in one Notion page.

doc/highlight.png

The two functions are sepreate functions, you can use only one of them or both.

Preparation

  1. Create two databases, one for saving queried words, the other one for saving highlight texts.

The sturcture of vocabulary database:

doc/vocabulary_notion_database.png

Name: Save the words

Source: Save the source of the word (the active window title when you query the word)

Date: Query date

The sturcture of highlights database:

doc/highlight_notion_database.png

Name: The page name(the active window title when you save the highlight), highlights from same webpage/app will be saved in same notion page.

Date: Save date

  1. You need a .MDX dictionary file to query the word, find the .MDX dictionary you perfer then put it path into config file or env variables.

Installation

pip install notiondict

Usage

Usage:
notiondict dict <word> [--config <file-path>]
notiondict highlight <text> [--config <file-path>]
notiondict -h | --help

Options:
--config <file-path>  your own config file
--help -h  show help

Examples

notiondict dict book --config /home/username/config.yml
notiondict highlight "This is a highlight"

Contents of requirements.txt

docopt==0.6.2
pyclip==0.6.0
PyYAML==6.0
readmdict==0.1.1
requests==2.28.1
setuptools==63.0.0
urllib3==1.26.12

Config file

Your need to save your Notion database id and Notion API Key in env variables or config file:

For env variables:

NOTION_HIGHLIGHT_DATABASE: Your_Notion_Database_Page_ID
NOTION_VOCABULARY_DATABASE: Your_Notion_Database_Page_ID
DICT_PATH: Your_Dict_Path
NOTION_API_KEY: Your_Notion_API_KEY

For config file:

There is a config file example in the repo, attach the config file by this way when you run NotionDict:

notiondict dict book --config /home/username/config.yml

Best practice

For Linux:

Use xsel to pass the selected text to NotionDict

notiondict dict "`xsel`"

For MacOS:

You can create a Shortcut to pass the acitve action to terminal.

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

notiondict-0.1.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notiondict-0.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file notiondict-0.1.1.tar.gz.

File metadata

  • Download URL: notiondict-0.1.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for notiondict-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50f49902d906cc56e9beac4d9fd7aead340d766a9cc367cee377730a00b8d930
MD5 da2a99a3fce450bb1c53e775c199a7ea
BLAKE2b-256 679eca133641d162a25ccc0e2fce51d8bb357536ae912f888948f3962abc9629

See more details on using hashes here.

File details

Details for the file notiondict-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: notiondict-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for notiondict-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7e29dc308964097cac6b0d9bd5d332ecae241a840e93cffc8f6590221cf744c
MD5 3522e135cd4b2ab6656f834302d825c4
BLAKE2b-256 e245d7960d9e7084b501f4358147d5056734f013a5e4a63655850b01f969e607

See more details on using hashes here.

Supported by

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