This is a Python script to help add words from Kindle to Anki.
- It can directly add words to Anki decks (using anki-connect ) or creates a anki-ready tsv file.
- Asks for card back in the terminal (optional).
- Adds words from both the Vocabulary Builder and your Notes (
My Clippings.txt
). Vocabulary builder holds all the words you look up in the dictionary on Kindle. Clippings are your highlights. - Last timestamp is written to
~/.kindle
. During next import only new lookups are exported. One can manipulate value written to~/.kindle
to get only needed words from Kindle. - Retrieve translations, images and sounds from LinguaLeo (from https://github.com/rampage644/kindle-to-anki)
This uses anki-connect , so make sure Anki is up and running.
- Import new words from vocabulary builder since last time, and asks for card back in the terminal. Words can be skipped (s) or you can quit at any words (q).
--clipboad
copies each word into clipboard so you can use it to look-up into any dictionary.$ ./kindle2anki.py --vocab-db '/run/media/Kindle/system/Vocabulary/vocab.db' --deck words --clipboard [0%] Word: include Context: Your Kindle includes one or more dictionaries for each supported language. Enter card back:[q/s]
- Import new words from clippings since last time Do not ask for card back (to edit later in Anki) when
--ano-ask
is provided$ ./kindle2anki.py --clippings '/run/media/Kindle/documents/My Clippings.txt' --deck words --no-ask
- I have not tested translation (code is from https://github.com/rampage644/kindle-to-anki)
- You can see my out-dated post How I transfer my vocabs from my Kindle Paperwhite to Anki . Arguments have changed since then.
The scripts uses anki-connect . Make sure you have installed it.
Then install this script from AUR or:
- Install Python 3
- Clone this repo
- Install requirements (
pip install -r requirements.txt
)
$ ./kindle2anki.py --help
usage: kindle2anki.py [-h] [--vocab-db VOCAB_DB] [--clippings CLIPPINGS]
[--deck DECK] [--update-timestamp] [--no-ask]
[--clipboard] [-o OUT] [-m MEDIA_PATH] [--email EMAIL]
[--pwd PWD] [--max-length MAX_LENGTH] [--verbose]
optional arguments:
-h, --help show this help message and exit
--vocab-db VOCAB_DB Path to Kindle vocab DB file (usually
"/system/vocabulary/vocab.db" on Kindle). Provide this
either this or --clippings
--clippings CLIPPINGS
Path to clippings (usually "/documents/My
Clippings.txt" on Kindle)
--deck DECK Anki deck name
--update-timestamp Only update local timestamp to now and exit
--no-ask Do not ask for card back in the command line
--clipboard Copy each word to clipboard
-o OUT, --out OUT CSV output filename to import into Anki, if not
provided words are added to Anki using anki-connect
-m MEDIA_PATH, --media-path MEDIA_PATH
Where to store media files (sounds/images) from
Lingualeo
--email EMAIL LinguaLeo account email/login
--pwd PWD LinguaLeo account password
--max-length MAX_LENGTH
Maximum length of words from clippings, to avoid
importing big sentences
--verbose Show debug messages
One can use udev rules to run this script automatically on Kindle connect. See https://github.com/seletskiy/runki#kindle–udev