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(add_info.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": ".card {\r\n font-family: arial;\r\n font-size: 20px;\r\n text-align: center;\r\n color: black;\r\n background-color: white;\r\n}\r\n"
}
}
}
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.2.tar.gz
(12.7 kB
view hashes)
Built Distribution
AnkiTools-0.3.2-py3-none-any.whl
(48.3 kB
view hashes)
Close
Hashes for AnkiTools-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edd49633a28437cf8e2a2bce8468bc64a9c435061fdd331468582707808018f8 |
|
MD5 | f76e642bb6624050993bd3757987300e |
|
BLAKE2b-256 | 4b81e75210915de864d11882ca7e03bf2860c7871d51706727d1da69678233d2 |