docker/anki/anki.ipynb

342 lines
31 KiB
Plaintext
Raw Permalink Normal View History

2023-07-30 09:37:30 +08:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d875f67a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Looking in indexes: http://mirrors.tencentyun.com/pypi/simple\n",
"Ignoring importlib-metadata: markers 'python_version >= \"3.8\" and python_version < \"3.10\"' don't match your environment\n",
"Ignoring zipp: markers 'python_version >= \"3.8\" and python_version < \"3.10\"' don't match your environment\n",
"Collecting anki==2.1.49 (from -r ./conf/requirements.txt (line 4))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/b8/e7/442dc5e500a95ddb91b1e6d90c510f799d672059cc904558a196f1923280/anki-2.1.49-cp38-abi3-manylinux2014_x86_64.whl (9.9 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.9/9.9 MB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m0m\n",
"\u001b[?25hRequirement already satisfied: beautifulsoup4==4.12.2 in /root/docker/miniconda3/lib/python3.11/site-packages (from -r ./conf/requirements.txt (line 5)) (4.12.2)\n",
"Collecting certifi==2023.5.7 (from -r ./conf/requirements.txt (line 6))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/9d/19/59961b522e6757f0c9097e4493fa906031b95b3ebe9360b2c3083561a6b4/certifi-2023.5.7-py3-none-any.whl (156 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m157.0/157.0 kB\u001b[0m \u001b[31m361.0 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting charset-normalizer==3.2.0 (from -r ./conf/requirements.txt (line 7))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/bc/85/ef25d4ba14c7653c3020a1c6e1a7413e6791ef36a0ac177efa605fc2c737/charset_normalizer-3.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m199.6/199.6 kB\u001b[0m \u001b[31m3.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting decorator==4.4.2 (from -r ./conf/requirements.txt (line 8))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)\n",
"Collecting distro==1.8.0 (from -r ./conf/requirements.txt (line 9))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/f4/2c/c90a3adaf0ddb70afe193f5ebfb539612af57cffe677c3126be533df3098/distro-1.8.0-py3-none-any.whl (20 kB)\n",
"Requirement already satisfied: idna==3.4 in /root/docker/miniconda3/lib/python3.11/site-packages (from -r ./conf/requirements.txt (line 10)) (3.4)\n",
"Collecting markdown==3.3.7 (from -r ./conf/requirements.txt (line 12))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/f3/df/ca72f352e15b6f8ce32b74af029f1189abffb906f7c137501ffe69c98a65/Markdown-3.3.7-py3-none-any.whl (97 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m97.8/97.8 kB\u001b[0m \u001b[31m397.4 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting orjson==3.9.2 (from -r ./conf/requirements.txt (line 13))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/b4/7e/12240e7d30d3c8a0abb13fad9f016ac051594c2219d407af1fc7d462ead0/orjson-3.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m138.7/138.7 kB\u001b[0m \u001b[31m488.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting protobuf==3.20.2 (from -r ./conf/requirements.txt (line 14))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/8b/e6/2a47ce2eba1aaf287380a44270da897ada03d118a55c19595ec7b4f0831f/protobuf-3.20.2-py2.py3-none-any.whl (162 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m162.1/162.1 kB\u001b[0m \u001b[31m4.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting psutil==5.9.5 (from -r ./conf/requirements.txt (line 15))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/af/4d/389441079ecef400e2551a3933224885a7bde6b8a4810091d628cdd75afe/psutil-5.9.5-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (282 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m282.1/282.1 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pysocks==1.7.1 in /root/docker/miniconda3/lib/python3.11/site-packages (from -r ./conf/requirements.txt (line 16)) (1.7.1)\n",
"Collecting requests==2.31.0 (from -r ./conf/requirements.txt (line 17))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl (62 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.6/62.6 kB\u001b[0m \u001b[31m423.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting send2trash==1.8.2 (from -r ./conf/requirements.txt (line 19))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/a9/78/e4df1e080ed790acf3a704edf521006dd96b9841bd2e2a462c0d255e0565/Send2Trash-1.8.2-py3-none-any.whl (18 kB)\n",
"Collecting soupsieve==2.4.1 (from -r ./conf/requirements.txt (line 20))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/49/37/673d6490efc51ec46d198c75903d99de59baffdd47aea3d071b80a9e4e89/soupsieve-2.4.1-py3-none-any.whl (36 kB)\n",
"Collecting stringcase==1.2.0 (from -r ./conf/requirements.txt (line 21))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/f3/1f/1241aa3d66e8dc1612427b17885f5fcd9c9ee3079fc0d28e9a3aeeb36fa3/stringcase-1.2.0.tar.gz (3.0 kB)\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting urllib3==2.0.3 (from -r ./conf/requirements.txt (line 22))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/8a/03/ad9306a50d05c166e3456fe810f33cee2b8b2a7a6818ec5d4908c4ec6b36/urllib3-2.0.3-py3-none-any.whl (123 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m123.6/123.6 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting webob==1.8.7 (from -r ./conf/requirements.txt (line 23))\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/62/9c/e94a9982e9f31fc35cf46cdc543a6c2c26cb7174635b5fd25b0bbc6a7bc0/WebOb-1.8.7-py2.py3-none-any.whl (114 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m115.0/115.0 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hBuilding wheels for collected packages: stringcase\n",
" Building wheel for stringcase (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for stringcase: filename=stringcase-1.2.0-py3-none-any.whl size=3569 sha256=d7e04c98d243b1bf594cbf2fd73bf04511a7406867ee7d3b695a9c6413b412fe\n",
" Stored in directory: /root/.cache/pip/wheels/4c/0c/49/074fffd81682caa8ae2d650567d819a43ee7f25eacce298fea\n",
"Successfully built stringcase\n",
"Installing collected packages: stringcase, webob, urllib3, soupsieve, send2trash, psutil, protobuf, orjson, markdown, distro, decorator, charset-normalizer, certifi, requests, anki\n",
" Attempting uninstall: urllib3\n",
" Found existing installation: urllib3 1.26.16\n",
" Uninstalling urllib3-1.26.16:\n",
" Successfully uninstalled urllib3-1.26.16\n",
" Attempting uninstall: soupsieve\n",
" Found existing installation: soupsieve 2.4\n",
" Uninstalling soupsieve-2.4:\n",
" Successfully uninstalled soupsieve-2.4\n",
" Attempting uninstall: send2trash\n",
" Found existing installation: Send2Trash 1.8.0\n",
" Uninstalling Send2Trash-1.8.0:\n",
" Successfully uninstalled Send2Trash-1.8.0\n",
" Attempting uninstall: psutil\n",
" Found existing installation: psutil 5.9.0\n",
" Uninstalling psutil-5.9.0:\n",
" Successfully uninstalled psutil-5.9.0\n",
" Attempting uninstall: decorator\n",
" Found existing installation: decorator 5.1.1\n",
" Uninstalling decorator-5.1.1:\n",
" Successfully uninstalled decorator-5.1.1\n",
" Attempting uninstall: charset-normalizer\n",
" Found existing installation: charset-normalizer 2.0.4\n",
" Uninstalling charset-normalizer-2.0.4:\n",
" Successfully uninstalled charset-normalizer-2.0.4\n",
" Attempting uninstall: certifi\n",
" Found existing installation: certifi 2023.7.22\n",
" Uninstalling certifi-2023.7.22:\n",
" Successfully uninstalled certifi-2023.7.22\n",
" Attempting uninstall: requests\n",
" Found existing installation: requests 2.29.0\n",
" Uninstalling requests-2.29.0:\n",
" Successfully uninstalled requests-2.29.0\n",
"Successfully installed anki-2.1.49 certifi-2023.5.7 charset-normalizer-3.2.0 decorator-4.4.2 distro-1.8.0 markdown-3.3.7 orjson-3.9.2 protobuf-3.20.2 psutil-5.9.5 requests-2.31.0 send2trash-1.8.2 soupsieve-2.4.1 stringcase-1.2.0 urllib3-2.0.3 webob-1.8.7\n",
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0mLooking in indexes: http://mirrors.tencentyun.com/pypi/simple\n",
"Collecting pyzstd\n",
" Downloading http://mirrors.tencentyun.com/pypi/packages/c3/7f/0d5c048cacb906fa40485b5bb9dc5de5993bff2e4c85fa77e5a89c413205/pyzstd-0.15.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (412 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m412.3/412.3 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hInstalling collected packages: pyzstd\n",
"Successfully installed pyzstd-0.15.9\n",
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
"\u001b[0m"
]
}
],
"source": [
"!cd ./anki-env/ && bash shell/build.sh\n",
"#!bash ./shell/start.sh"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c5c4b4ea",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"root = os.getcwd()\n",
"os.chdir(root + \"/anki-sync-server/src\")\n",
"#os.chdir(root)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ab7f33f9",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[2023-07-29 02:37:39,550]:INFO:ankisyncd.config:Loaded config from /data/anki/ankisyncd/ankisyncd.conf\n",
"[2023-07-29 02:37:39,551]:INFO:ankisyncd.users:Found auth_db_path in config, using SqliteUserManager for auth\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"anki\n"
]
}
],
"source": [
"import sys\n",
"import getpass\n",
"from ankisyncd import config as config_provider\n",
"from ankisyncd.users import get_user_manager\n",
"config = config_provider.load_from_file()\n",
"config_provider.load_from_env(config)\n",
"username = \"anki\"\n",
"password = \"ouczbs\"\n",
"user_manager = get_user_manager(config)\n",
"# user_manager.add_user(username, password)\n",
"users = user_manager.user_list()\n",
"for username in users:\n",
" print(username)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c218d033",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[2023-07-29 02:37:41,526]:INFO:ankisyncd:ankisyncd [unknown version] (https://github.com/ankicommunity/anki-sync-server.git)\n",
"[2023-07-29 02:37:41,527]:INFO:ankisyncd.config:Loaded config from /data/anki/ankisyncd/ankisyncd.conf\n",
"[2023-07-29 02:37:41,528]:INFO:ankisyncd.users:Found auth_db_path in config, using SqliteUserManager for auth\n",
"[2023-07-29 02:37:41,530]:INFO:ankisyncd.sessions:Found session_db_path in config, using SqliteSessionManager for auth\n",
"[2023-07-29 02:37:41,538]:INFO:ankisyncd.server:Serving HTTP on 0.0.0.0 port 27001...\n",
"[2023-07-29 02:38:09,209]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":11,\"cv\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,219]:INFO:ankisyncd.CollectionThread[anki]:Starting...\n",
"[2023-07-29 02:38:09,222]:INFO:ankisyncd.CollectionThread[anki]:Running meta(*[], **{'v': 11, 'cv': 'anki,2.1.64 (581f82c5),win:10'})\n",
"[2023-07-29 02:38:09,269]:INFO:ankisyncd:<<<<<::response body or size: b'{\"mod\": 1690598178633, \"scm\": 1690470330406, \"usn\": 15, \"ts\": 1690598289, \"musn\": 0, \"uname\": \"anki\", \"msg\": \"\", \"cont\": true, \"hostNum\": 0}' compress size117\n",
"[2023-07-29 02:38:09,270]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/meta HTTP/1.0\" 200 117\n",
"[2023-07-29 02:38:09,272]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'uauMP'}\n",
"[2023-07-29 02:38:09,273]:INFO:ankisyncd.CollectionThread[anki]:Running begin(*[], **{'skey': 'e0386f91'})\n",
"[2023-07-29 02:38:09,274]:INFO:ankisyncd:<<<<<::response body or size: b'{\"data\": {\"sk\": \"e0386f91\", \"usn\": 0}, \"err\": \"\"}' compress size58\n",
"[2023-07-29 02:38:09,274]:INFO:ankisyncd.http:172.18.0.4 \"POST /msync/begin HTTP/1.0\" 200 58\n",
"[2023-07-29 02:38:09,281]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"minUsn\":15,\"lnewer\":true,\"graves\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,282]:INFO:ankisyncd.CollectionThread[anki]:Running start(*[], **{'minUsn': 15, 'lnewer': True, 'graves': None})\n",
"[2023-07-29 02:38:09,285]:INFO:ankisyncd:<<<<<::response body or size: b'{\"cards\": [], \"notes\": [], \"decks\": []}' compress size45\n",
"[2023-07-29 02:38:09,286]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/start HTTP/1.0\" 200 45\n",
"[2023-07-29 02:38:09,296]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"changes\":{\"models\":[],\"decks\":[[],[]],\"tags\":[],\"conf\":{\"backups\":{\"daily\":12,\"minimum_interval_mins\":30,\"monthly\":9,\"weekly\":10},\"_deck_1_lastNotetype\":1690470330408,\"_nt_1690470330408_lastDeck\":1,\"lastUnburied\":2,\"newSpread\":0,\"nextPos\":4,\"defaultSearchText\":\"\",\"ignoreAccentsInSearch\":false,\"localOffset\":-480,\"pasteImagesAsPng\":false,\"pasteStripsFormatting\":false,\"rollover\":4,\"schedVer\":2,\"dueCounts\":true,\"curModel\":1690470330408,\"collapseTime\":1200,\"activeDecks\":[1690564414917],\"curDeck\":1690564414917,\"addToCur\":true,\"estTimes\":true,\"hideAudioPlayButtons\":false,\"newBury\":true,\"sortType\":\"noteFld\",\"sortBackwards\":false,\"timeLim\":0,\"dayLearnFirst\":false,\"interruptAudioWhenAnswering\":true},\"crt\":1690430400}}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,297]:INFO:ankisyncd.CollectionThread[anki]:Running applyChanges(*[], **{'changes': {'models': [], 'decks': [[], []], 'tags': [], 'conf': {'backups': {'daily': 12, 'minimum_interval_mins': 30, 'monthly': 9, 'weekly': 10}, '_deck_1_lastNotetype': 1690470330408, '_nt_1690470330408_lastDeck': 1, 'lastUnburied': 2, 'newSpread': 0, 'nextPos': 4, 'defaultSearchText': '', 'ignoreAccentsInSearch': False, 'localOffset': -480, 'pasteImagesAsPng': False, 'pasteStripsFormatting': False, 'rollover': 4, 'schedVer': 2, 'dueCounts': True, 'curModel': 1690470330408, 'collapseTime': 1200, 'activeDecks': [1690564414917], 'curDeck': 1690564414917, 'addToCur': True, 'estTimes': True, 'hideAudioPlayButtons': False, 'newBury': True, 'sortType': 'noteFld', 'sortBackwards': False, 'timeLim': 0, 'dayLearnFirst': False, 'interruptAudioWhenAnswering': True}, 'crt': 1690430400}})\n",
"[2023-07-29 02:38:09,313]:INFO:ankisyncd:<<<<<::response body or size: b'{\"models\": [], \"decks\": [[], []], \"tags\": []}' compress size54\n",
"[2023-07-29 02:38:09,314]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/applyChanges HTTP/1.0\" 200 54\n",
"[2023-07-29 02:38:09,325]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"_pad\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,327]:INFO:ankisyncd.CollectionThread[anki]:Running chunk(*[], **{})\n",
"[2023-07-29 02:38:09,332]:INFO:ankisyncd:<<<<<::response body or size: b'{\"done\": true, \"notes\": [], \"cards\": [], \"revlog\": []}' compress size63\n",
"[2023-07-29 02:38:09,334]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/chunk HTTP/1.0\" 200 63\n",
"[2023-07-29 02:38:09,343]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"chunk\":{\"done\":true}}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,344]:INFO:ankisyncd.CollectionThread[anki]:Running applyChunk(*[], **{'chunk': {'done': True}})\n",
"[2023-07-29 02:38:09,346]:INFO:ankisyncd:<<<<<::response body or size: b'null' compress size13\n",
"[2023-07-29 02:38:09,348]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/applyChunk HTTP/1.0\" 200 13\n",
"[2023-07-29 02:38:09,357]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"client\":[[0,0,0],48,48,1,6,6,2,1]}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,358]:INFO:ankisyncd.CollectionThread[anki]:Running sanityCheck2(*[], **{'client': [[0, 0, 0], 48, 48, 1, 6, 6, 2, 1]})\n",
"[2023-07-29 02:38:09,361]:INFO:ankisyncd:<<<<<::response body or size: b'{\"status\": \"ok\"}' compress size25\n",
"[2023-07-29 02:38:09,362]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/sanityCheck2 HTTP/1.0\" 200 25\n",
"[2023-07-29 02:38:09,371]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"_pad\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'beb5Tq'}\n",
"[2023-07-29 02:38:09,372]:INFO:ankisyncd.CollectionThread[anki]:Running finish(*[], **{})\n",
"[2023-07-29 02:38:09,377]:INFO:ankisyncd:<<<<<::response body or size: b'1690598289373' compress size22\n",
"[2023-07-29 02:38:09,378]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/finish HTTP/1.0\" 200 22\n",
"[2023-07-29 02:38:15,011]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'dEnCxC'}\n",
"[2023-07-29 02:38:15,013]:INFO:ankisyncd.CollectionThread[anki]:Running begin(*[], **{'skey': 'e0386f91'})\n",
"[2023-07-29 02:38:15,014]:INFO:ankisyncd:<<<<<::response body or size: b'{\"data\": {\"sk\": \"e0386f91\", \"usn\": 0}, \"err\": \"\"}' compress size58\n",
"[2023-07-29 02:38:15,015]:INFO:ankisyncd.http:172.18.0.4 \"POST /msync/begin HTTP/1.0\" 200 58\n",
"[2023-07-29 02:38:15,016]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":11,\"cv\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'ekPDWV'}\n",
"[2023-07-29 02:38:15,039]:INFO:ankisyncd.CollectionThread[anki]:Running meta(*[], **{'v': 11, 'cv': 'anki,2.1.64 (581f82c5),win:10'})\n",
"[2023-07-29 02:38:15,041]:INFO:ankisyncd:<<<<<::response body or size: b'{\"mod\": 1690598289373, \"scm\": 1690470330406, \"usn\": 16, \"ts\": 1690598295, \"musn\": 0, \"uname\": \"anki\", \"msg\": \"\", \"cont\": true, \"hostNum\": 0}' compress size115\n",
"[2023-07-29 02:38:15,042]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/meta HTTP/1.0\" 200 115\n",
"[2023-07-29 02:39:03,690]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":11,\"cv\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,700]:INFO:ankisyncd.CollectionThread[anki]:Running meta(*[], **{'v': 11, 'cv': 'anki,2.1.64 (581f82c5),win:10'})\n",
"[2023-07-29 02:39:03,702]:INFO:ankisyncd:<<<<<::response body or size: b'{\"mod\": 1690598289373, \"scm\": 1690470330406, \"usn\": 16, \"ts\": 1690598343, \"musn\": 0, \"uname\": \"anki\", \"msg\": \"\", \"cont\": true, \"hostNum\": 0}' compress size115\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[2023-07-29 02:39:03,704]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/meta HTTP/1.0\" 200 115\n",
"[2023-07-29 02:39:03,706]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"v\":\"anki,2.1.64 (581f82c5),win:10\"}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'dneLt1'}\n",
"[2023-07-29 02:39:03,708]:INFO:ankisyncd.CollectionThread[anki]:Running begin(*[], **{'skey': 'e0386f91'})\n",
"[2023-07-29 02:39:03,708]:INFO:ankisyncd:<<<<<::response body or size: b'{\"data\": {\"sk\": \"e0386f91\", \"usn\": 0}, \"err\": \"\"}' compress size58\n",
"[2023-07-29 02:39:03,709]:INFO:ankisyncd.http:172.18.0.4 \"POST /msync/begin HTTP/1.0\" 200 58\n",
"[2023-07-29 02:39:03,712]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"minUsn\":16,\"lnewer\":true,\"graves\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,713]:INFO:ankisyncd.CollectionThread[anki]:Running start(*[], **{'minUsn': 16, 'lnewer': True, 'graves': None})\n",
"[2023-07-29 02:39:03,714]:INFO:ankisyncd:<<<<<::response body or size: b'{\"cards\": [], \"notes\": [], \"decks\": []}' compress size45\n",
"[2023-07-29 02:39:03,715]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/start HTTP/1.0\" 200 45\n",
"[2023-07-29 02:39:03,724]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"changes\":{\"models\":[],\"decks\":[[{\"id\":1690564414917,\"mod\":1690598340,\"name\":\"\\xe8\\xb5\\x96\\xe4\\xb8\\x96\\xe9\\x9b\\x84\\xe9\\x9f\\xb3\\xe6\\xa0\\x87\",\"usn\":16,\"lrnToday\":[2,0],\"revToday\":[2,0],\"newToday\":[2,2],\"timeToday\":[2,18928],\"collapsed\":false,\"browserCollapsed\":false,\"desc\":\"Please see the <a href=\\'https://ankiweb.net/shared/info/745168042\\'>shared deck page</a> for more info.\",\"dyn\":0,\"conf\":1,\"extendNew\":0,\"extendRev\":0,\"reviewLimit\":null,\"newLimit\":null,\"reviewLimitToday\":null,\"newLimitToday\":null}],[]],\"tags\":[],\"conf\":{\"localOffset\":-480,\"collapseTime\":1200,\"pasteImagesAsPng\":false,\"sortBackwards\":false,\"newSpread\":0,\"lastUnburied\":2,\"rollover\":4,\"_nt_1690470330408_lastDeck\":1,\"timeLim\":0,\"newBury\":true,\"defaultSearchText\":\"\",\"backups\":{\"daily\":12,\"minimum_interval_mins\":30,\"monthly\":9,\"weekly\":10},\"curModel\":1690470330408,\"nextPos\":4,\"pasteStripsFormatting\":false,\"addToCur\":true,\"sortType\":\"noteFld\",\"curDeck\":1690564414917,\"dayLearnFirst\":false,\"hideAudioPlayButtons\":false,\"interruptAudioWhenAnswering\":true,\"ignoreAccentsInSearch\":false,\"schedVer\":2,\"_deck_1_lastNotetype\":1690470330408,\"activeDecks\":[1690564414917],\"dueCounts\":true,\"estTimes\":true},\"crt\":1690430400}}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,725]:INFO:ankisyncd.CollectionThread[anki]:Running applyChanges(*[], **{'changes': {'models': [], 'decks': [[{'id': 1690564414917, 'mod': 1690598340, 'name': '赖世雄音标', 'usn': 16, 'lrnToday': [2, 0], 'revToday': [2, 0], 'newToday': [2, 2], 'timeToday': [2, 18928], 'collapsed': False, 'browserCollapsed': False, 'desc': \"Please see the <a href='https://ankiweb.net/shared/info/745168042'>shared deck page</a> for more info.\", 'dyn': 0, 'conf': 1, 'extendNew': 0, 'extendRev': 0, 'reviewLimit': None, 'newLimit': None, 'reviewLimitToday': None, 'newLimitToday': None}], []], 'tags': [], 'conf': {'localOffset': -480, 'collapseTime': 1200, 'pasteImagesAsPng': False, 'sortBackwards': False, 'newSpread': 0, 'lastUnburied': 2, 'rollover': 4, '_nt_1690470330408_lastDeck': 1, 'timeLim': 0, 'newBury': True, 'defaultSearchText': '', 'backups': {'daily': 12, 'minimum_interval_mins': 30, 'monthly': 9, 'weekly': 10}, 'curModel': 1690470330408, 'nextPos': 4, 'pasteStripsFormatting': False, 'addToCur': True, 'sortType': 'noteFld', 'curDeck': 1690564414917, 'dayLearnFirst': False, 'hideAudioPlayButtons': False, 'interruptAudioWhenAnswering': True, 'ignoreAccentsInSearch': False, 'schedVer': 2, '_deck_1_lastNotetype': 1690470330408, 'activeDecks': [1690564414917], 'dueCounts': True, 'estTimes': True}, 'crt': 1690430400}})\n",
"[2023-07-29 02:39:03,732]:INFO:ankisyncd:<<<<<::response body or size: b'{\"models\": [], \"decks\": [[], []], \"tags\": []}' compress size54\n",
"[2023-07-29 02:39:03,734]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/applyChanges HTTP/1.0\" 200 54\n",
"[2023-07-29 02:39:03,741]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"_pad\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,742]:INFO:ankisyncd.CollectionThread[anki]:Running chunk(*[], **{})\n",
"[2023-07-29 02:39:03,748]:INFO:ankisyncd:<<<<<::response body or size: b'{\"done\": true, \"notes\": [], \"cards\": [], \"revlog\": []}' compress size63\n",
"[2023-07-29 02:39:03,749]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/chunk HTTP/1.0\" 200 63\n",
"[2023-07-29 02:39:03,757]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"chunk\":{\"done\":true,\"revlog\":[[1690598340609,1535892745436,16,3,-600,-60,0,13610,0]],\"cards\":[[1535892745436,1535892745390,1690564414917,0,1690598340,16,1,1,1690598980,0,0,1,0,1001,0,0,0,\"{}\"]]}}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,758]:INFO:ankisyncd.CollectionThread[anki]:Running applyChunk(*[], **{'chunk': {'done': True, 'revlog': [[1690598340609, 1535892745436, 16, 3, -600, -60, 0, 13610, 0]], 'cards': [[1535892745436, 1535892745390, 1690564414917, 0, 1690598340, 16, 1, 1, 1690598980, 0, 0, 1, 0, 1001, 0, 0, 0, '{}']]}})\n",
"[2023-07-29 02:39:03,762]:INFO:ankisyncd:<<<<<::response body or size: b'null' compress size13\n",
"[2023-07-29 02:39:03,763]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/applyChunk HTTP/1.0\" 200 13\n",
"[2023-07-29 02:39:03,771]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"client\":[[0,0,0],48,48,2,6,6,2,1]}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,772]:INFO:ankisyncd.CollectionThread[anki]:Running sanityCheck2(*[], **{'client': [[0, 0, 0], 48, 48, 2, 6, 6, 2, 1]})\n",
"[2023-07-29 02:39:03,775]:INFO:ankisyncd:<<<<<::response body or size: b'{\"status\": \"ok\"}' compress size25\n",
"[2023-07-29 02:39:03,776]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/sanityCheck2 HTTP/1.0\" 200 25\n",
"[2023-07-29 02:39:03,784]:INFO:ankisyncd:>>>>>::request body or size: {'data': b'{\"_pad\":null}', 'v': 11, 'k': 'bc11cda8e476ff59fcb38b0472d761bf', 'c': '2.1.64,581f82c5,windows', 's': 'WB9Ha'}\n",
"[2023-07-29 02:39:03,785]:INFO:ankisyncd.CollectionThread[anki]:Running finish(*[], **{})\n",
"[2023-07-29 02:39:03,790]:INFO:ankisyncd:<<<<<::response body or size: b'1690598343786' compress size22\n",
"[2023-07-29 02:39:03,791]:INFO:ankisyncd.http:172.18.0.4 \"POST /sync/finish HTTP/1.0\" 200 22\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cards [[1535892745436, 1535892745390, 1690564414917, 0, 1690598340, 16, 1, 1, 1690598980, 0, 0, 1, 0, 1001, 0, 0, 0, '{}']]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[2023-07-29 02:40:41,532]:INFO:ankisyncd.ThreadingCollectionManager:Monitor is closing collection on inactive CollectionThread[anki]\n",
"[2023-07-29 02:40:41,538]:INFO:ankisyncd.CollectionThread[anki]:Running _close(*[], **{})\n"
]
}
],
"source": [
"import os\n",
"import sys\n",
"\n",
"import ankisyncd\n",
"from ankisyncd.config import load_from_file\n",
"from ankisyncd.config import load_from_env\n",
"from ankisyncd import logging\n",
"from ankisyncd.sync_app import SyncApp\n",
"import importlib\n",
"importlib.reload(ankisyncd.sync_app)\n",
"from ankisyncd.server import run_server\n",
"\n",
"logger = logging.get_logger(\"ankisyncd\")\n",
"logger.info(\n",
" \"ankisyncd {} ({})\".format(ankisyncd._get_version(), ankisyncd._homepage)\n",
")\n",
"config = load_from_file()\n",
"load_from_env(config)\n",
"\n",
"ankiserver = SyncApp(config)\n",
"run_server(ankiserver, config[\"host\"], int(config[\"port\"]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e970ec4f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}