Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/psamim/kindle2anki

Add words from Kindle to Anki
https://github.com/psamim/kindle2anki

anki kindle

Last synced: 2 months ago
JSON representation

Add words from Kindle to Anki

Awesome Lists containing this project

README

        

#+TITLE: kindle2anki

* Description
This is a Python script to help add words from Kindle to Anki.

* Features
- It can directly add words to Anki decks (using [[https://github.com/FooSoft/anki-connect][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)

* Usage
This uses [[https://github.com/FooSoft/anki-connect][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.

#+BEGIN_SRC shell
$ ./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]
#+END_SRC

- Import new words from clippings since last time Do not ask for card back (to edit later in Anki) when =--ano-ask= is provided

#+BEGIN_SRC shell
$ ./kindle2anki.py --clippings '/run/media/Kindle/documents/My Clippings.txt' --deck words --no-ask
#+END_SRC

- I have not tested translation (code is from https://github.com/rampage644/kindle-to-anki)

- You can see my out-dated post [[https://dev.to/psamim/how-i-transfer-my-vocabs-from-my-kindle-paperwhite-to-anki-1f4d][How I transfer my vocabs from my Kindle Paperwhite to Anki]] . Arguments have changed since then.

* Install
The scripts uses [[https://github.com/FooSoft/anki-connect][anki-connect]] . Make sure you have installed it.

Then install this script from [[https://aur.archlinux.org/packages/kindle2anki-git/][AUR]] or:

- Install Python 3
- Clone this repo
- Install requirements (=pip install -r requirements.txt=)

* Help
#+BEGIN_SRC shell
$ ./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
#+END_SRC shell

* Automatic Sync
One can use udev rules to run this script automatically on Kindle connect. See
https://github.com/seletskiy/runki#kindle--udev

* Credits
- https://github.com/rampage644/kindle-to-anki
- https://github.com/sebpearce/firewood
- https://github.com/seletskiy/runki