Skip to content

kentonself/spanki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spanki

Command line tool to lookup Foreign language words from multiple dictionaries and easily add them to an anki deck

(Originally developed for Spanish. SPanish + ANKI = SPANKI)

Spanki can use a variety of foreign language dictionaries from rapidapi and the user can pick a translation and immediately create a card in an Anki deck for future recall/study. API calls are threaded for faster response.

Requirements

  1. Python installed.
  2. Either
  3. A running instance of Anki with the AnkiConnect Add-In (https://ankiweb.net/shared/info/2055492159)
  4. A deck in Anki to add new cards to.

Environment

Spanki uses the following environment variables:

SPANKI_APIS            - Mandatory A comma separated list of APIs to check (see Examples below)
SPANKI_KEY             - Mandatory if using rapidapi. The key from rapidapi ("X-RapidAPI-Key") for your subscriptions
SPANKI_DECK_NAME       - Mandatory. The deck name in Anki to add cards to.
SPANKI_NOTE_TYPE       - Optional. If set Spanki will add fields for gender and part of speech, oherwise wil insert a
                                   basic front/back card
SPANKI_SYNC_ON_ADD     - Optional. If set (unless set to 0 or False), will sync with AnkiWeb after each add.
                                  (Can add time for sync)
SPANKI_LANG            - Optional. Language code to be translated. Ex. "es" for Spanish, "it" for Italian, etc.
                                   (Defaults to Spanish. Only tested in Spanish, so YMMV)
SPANKI_ANKICONNECT_URL - Optional. If set will override the default AnkiConnect address http://localhost:8765

Examples:

export SPANKI_KEY=0123456789abcdef123456789aabcdef123456789abcdef01
export SPANKI_APIS=mymemory,multi-traduction,long-translator,rest4dict
export SPANKI_DECK_NAME=Kenton\'s\ Spanish\ Words
export SPANKI_NOTE_TYPE=Spanish
export SPANKI_SYNC_ON_ADD=1
export SPANKI_LANG=es
export SPANK_ANKICONNECT_URL=http://remotehost.local:8765

Usage

Run spanky.py from the command line. Enter a word or phrase in Spanish. When translation is returned, spanki can create a card and add it to the Anki deck. You can enter the part of speech and gender (for nouns)

DEMO

License

GNU GENERAL PUBLIC LICENSE

TODO

  • Add other target languages besides English
  • Add more API's
  • Look up words in fd-spa-eng dictionary of linux dict command (incorporate with rest4dict)
  • Parse the return from API call to AnkiConnect to be cleaner

Contribution

Please submit pull requests! Before doing so, test code by adding a word to an anki deck and run pylint until it shows 10/10

About

Command line tool to enter foreign words and add them to an anki deck for study.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages