an Anki *.apkg and collection.anki2 reader and editor
Project description
AnkiTools
An Anki *.apkg and collection.anki2 reader and editor to work with in Python. Also included a module on AnkiConnect.
I also created a new sync system called AnkiDirect.
The *.apkg format specification can be viewed from Anki decks collaboration Wiki and AnkiDroid. In my AnkiDirect, I tried to comply with the format specification as much as possible.
Installation
pip install AnkiTools
Features
- Read and write to Anki database in Application Data.
- Read and create Anki file without Anki
- Convert back and forth to Excel.
Examples
import json
from collections import OrderedDict
from AnkiTools import AnkiDirect
if __name__ == '__main__':
with open('notes.json') as f:
data = json.load(f, object_pairs_hook=OrderedDict)
api = AnkiDirect()
api.add(data)
api.conn.commit()
where notes.json
is
{
"data": {
"note_type A": [
{
"data": {
"header A": "a",
"header B": "b"
},
"decks": {
"Forward": "Test Deck::Forward",
"Backward": "Test Deck::Backward"
}
}
]
},
"definitions": {
"note_type A": {
"templates": [
{
"name": "Forward",
"data": {
"qfmt": "{{header A}}",
"afmt": "{{FrontSide}}\r\n\r\n<hr id=answer>\r\n\r\n{{header B}}"
}
},
{
"name": "Backward",
"data": {
"qfmt": "{{header B}}",
"afmt": "{{FrontSide}}\r\n\r\n<hr id=answer>\r\n\r\n{{header A}}"
}
}
],
"css": "This is a test css."
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
AnkiTools-0.3.1.tar.gz
(12.2 kB
view hashes)
Built Distribution
AnkiTools-0.3.1-py3-none-any.whl
(44.2 kB
view hashes)
Close
Hashes for AnkiTools-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c40543f1c60f690d54d7f6427b480bec95c4efbedfc7436f537583cbae00be4 |
|
MD5 | 13806fbbd799708977da85c5273c9d63 |
|
BLAKE2b-256 | 1851d57b0c45717653637e2c1292593a92e8976db4fdc1e296ad13d984cd556f |