kindle2anki
Description
This is a Python script to help add words from Kindle to Anki.
Features
- It can directly add words to Anki decks 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
). - 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)
Usage
- You can my post How I transfer my vocabs from my Kindle Paperwhite to Anki
- 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).
$ ./kindle2anki.py --kindle '/run/media/samim/Kindle/system/Vocabulary/vocab.db' \ --collection '~/Documents/Anki/User 1/collection.anki2' --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 notes since last time, do not ask for card back (to edit later in Anki).
$ ./kindle2anki.py --src '/run/media/samim/Kindle/documents/My Clippings.txt' \ --collection '~/Documents/Anki/User 1/collection.anki2' --deck words --no-ask
- I have not tested translation (from https://github.com/rampage644/kindle-to-anki)
Install
From AUR or:
- Install Python 3
- Clone this repo and init the submodules.
- Install requirements (
pip install -r requirements.txt
)
Help
$ ./kindle2anki.py --help
usage: kindle2anki.py [-h] [--kindle KINDLE] [--src SRC]
[--collection COLLECTION] [--deck DECK] [-o OUT]
[-m MEDIA_PATH] [--email EMAIL] [--update-timestamp]
[--pwd PWD] [--max-length MAX_LENGTH] [--verbose]
[--no-ask] [--clipboard]
optional arguments:
-h, --help show this help message and exit
--kindle KINDLE Path to kindle db file (usually vocab.db)
--src SRC Path to "documents/My Clippings.txt" on kindle
--collection COLLECTION
Path to anki collection file (.anki file)
--deck DECK Anki deck name
-o OUT, --out OUT CSV output filename to import into anki, if not
provided words are added to provided Anki deck and
collection
-m MEDIA_PATH, --media-path MEDIA_PATH
Where to store media files (sounds/images) from
Lingualeo
--email EMAIL LinguaLeo account email/login
--update-timestamp Update local timestamp to now and exit
--pwd PWD LinguaLeo account password
--max-length MAX_LENGTH
Maximum length of words from clippings, to avoid
importing big sentences
--verbose Show debug messages
--no-ask Do not ask for card back in the command line
--clipboard Copy each word to clipboard
Automatic Sync
One can use udev rules to run this script automatically on Kindle connect. See https://github.com/seletskiy/runki#kindle–udev