Build and rebuild Anki flashcard decks.
The strategy is presented in build_chinese_deck.sh
:
- Start with a
.tsv
file that has only one column: the terms from the source language. - The script then fetches translations and audio files from google translate. It updates the
.tsv
file to hold four columns. It downloads the mp3's into an auxilliary directory (which you can delete afterward if you wish). - The script then populates a sqlite database
collection.anki2
with note+card information for all of the terms in the.tsv.
- The script then makes hard links whose names are decimal numbers [1-infinity], which is what Anki appears to require.
- The script then zips the media files,
media
file, and sqlite db into a.apkg
file.
This application makes use of:
- Bash
- Node.js
- google-translate-token (Node.js module)
export PYTHONIOENCODING=UTF-8
allows Python to interpret and print Chinese characters.
export LANG=en_US.UTF-8
allows terminal to interpret and print Chinese characters.