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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file AnkiTools-0.3.1.tar.gz.
File metadata
- Download URL: AnkiTools-0.3.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3ac4f1ee223276ade8ac4d867e1cf20460fed3172df7c6782a27a5324ff7710
|
|
| MD5 |
f99470f7007f72667c14a7839fd15cdc
|
|
| BLAKE2b-256 |
721b0564230a80594b9721249a2826ac8c4d0b3a93fdccb4b7e9a4b0db3e6790
|
File details
Details for the file AnkiTools-0.3.1-py3-none-any.whl.
File metadata
- Download URL: AnkiTools-0.3.1-py3-none-any.whl
- Upload date:
- Size: 44.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c40543f1c60f690d54d7f6427b480bec95c4efbedfc7436f537583cbae00be4
|
|
| MD5 |
13806fbbd799708977da85c5273c9d63
|
|
| BLAKE2b-256 |
1851d57b0c45717653637e2c1292593a92e8976db4fdc1e296ad13d984cd556f
|