| addon | ||
| anki-bundled@22d6feed87 | ||
| ankisyncd | ||
| tests | ||
| .gitignore | ||
| .gitmodules | ||
| ankisyncctl.py | ||
| ankisyncd.conf | ||
| COPYING | ||
| README.md | ||
ankisyncd
Anki is a powerful open source flashcard application, which helps you quickly and easily memorize facts over the long term utilizing a spaced repetition algorithm. Anki's main form is a desktop application (for Windows, Linux and macOS) which can sync to a web version (AnkiWeb) and mobile versions for Android and iOS.
This is a personal Anki server, which you can sync against instead of AnkiWeb. It was originally developed to support the flashcard functionality on Bibliobird, a web application for language learning.
This version is a fork of jdoe0/ankisyncd. It supports Python 3 and Anki 2.1.
Installing
-
Install Anki. The currently supported version range is 2.1.1〜2.1.10, with the exception of 2.1.91. (Keep in mind this range only applies to the Anki used by the server, clients can be as old as 2.0.27 and still work.) Running the server with other versions might work as long as they're not 2.0.x, but things might break, so do it at your own risk. If for some reason you can't get the supported Anki version easily on your system, you can use
anki-bundledfrom this repo:$ git submodule update --init $ cd anki-bundled $ pip install -r requirements.txtKeep in mind
pyaudio, a dependency of Anki, requires Python 3 and PortAudio headers to be present before runningpip. If you can't or don't want to install these, you can try patching Anki. -
Install the dependencies:
$ pip install webob -
Modify ankisyncd.conf according to your needs
-
Create user:
$ ./ankisyncctl.py adduser <username> -
Run ankisyncd:
$ python -m ankisyncd
- 2.1.9 is not supported due to commit
95ccbfdd3679introducing the dependency on theaqtmodule, which depends on PyQt5. The server should still work fine if you have PyQt5 installed. This has been fixed in commita389b8b4a0e2, which is a part of the 2.1.10 release. ↑
Installing (Docker)
Follow these instructions.
Setting up Anki
Anki 2.1
Create a new directory in the add-ons folder (name it something
like ankisyncd), create a file named __init__.py containing the code below
and put it in the ankisyncd directory.
import anki.sync, anki.hooks, aqt
addr = "http://127.0.0.1:27701/" # put your server address here
anki.sync.SYNC_BASE = "%s" + addr
def resetHostNum():
aqt.mw.pm.profile['hostNum'] = None
anki.hooks.addHook("profileLoaded", resetHostNum)
Anki 2.0
Create a file (name it something like ankisyncd.py) containing the code below
and put it in ~/Anki/addons.
import anki.sync
addr = "http://127.0.0.1:27701/" # put your server address here
anki.sync.SYNC_BASE = addr
anki.sync.SYNC_MEDIA_BASE = addr + "msync/"
AnkiDroid
Advanced → Custom sync server
Unless you have set up a reverse proxy to handle encrypted connections, use
http as the protocol. The port will be either the default, 27701, or
whatever you have specified in ankisyncd.conf (or, if using a reverse proxy,
whatever port you configured to accept the front-end connection).
Do not use trailing slashes.
Even though the AnkiDroid interface will request an email address, this is not
required; it will simply be the username you configured with ankisyncctl.py adduser.
Running ankisyncd without pyaudio
ankisyncd doesn't use the audio recording feature of Anki, so if you don't
want to install PortAudio, you can edit anki-bundled/anki/sound.py and
anki-bundled/requirements.txt to exclude pyaudio:
ed version:
$ echo '/# Packaged commands/,$d;w' | tr ';' '\n' | ed anki/sound.py
$ echo '/^pyaudio/d;w' | tr ';' '\n' | ed requirements.txt
sed -i version:
$ sed -i '/# Packaged commands/,$d' anki/sound.py
$ sed -i '/^pyaudio/d' requirements.txt
Manual version: remove every line past "# Packaged commands" in anki/sound.py, remove every line starting with "pyaudio" in requirements.txt