{"id":18918852,"url":"https://github.com/alexw00/anki-patcher","last_synced_at":"2025-04-15T10:33:16.355Z","repository":{"id":204122476,"uuid":"711150483","full_name":"AlexW00/anki-patcher","owner":"AlexW00","description":"🩹 A modular python script launcher to patch anki cards en masse","archived":false,"fork":false,"pushed_at":"2024-09-01T10:45:08.000Z","size":230,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-02T00:22:10.290Z","etag":null,"topics":["anki","anki-cards","flashcards","python","spaced-repetition"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexW00.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-28T11:20:58.000Z","updated_at":"2024-06-02T22:10:20.000Z","dependencies_parsed_at":"2023-11-01T10:30:21.416Z","dependency_job_id":"690a66b5-91a4-4986-9376-3e8a40a0d6fa","html_url":"https://github.com/AlexW00/anki-patcher","commit_stats":null,"previous_names":["alexw00/anki-patcher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2Fanki-patcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2Fanki-patcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2Fanki-patcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexW00%2Fanki-patcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexW00","download_url":"https://codeload.github.com/AlexW00/anki-patcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223669435,"owners_count":17183108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anki","anki-cards","flashcards","python","spaced-repetition"],"created_at":"2024-11-08T10:34:03.292Z","updated_at":"2025-04-15T10:33:16.349Z","avatar_url":"https://github.com/AlexW00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🩹 Anki Patcher\n\n= modular python script launcher to patch anki cards en masse\n\n## Basic Idea\n\nAnki patcher is a script launcher to manipulate anki cards via patch `operations` defined as python functions.\n\nAn operation is a python file with an `execute (card_id, fields, config)` function. This function gets called for each card of a specified deck and can execute arbitrary code on the card. The `card_id` and `fields` are provided by anki pacher and the `config` is a parsed .yml file provided by the user.\n\n## Setup\n\n- run `poetry install`\n- run `poetry shell` and `python -m unidic download` to download the unidic dictionary\n- add an .env file to the root of the project (based on .env.example)\n- install anki-connect add-on in your anki desktop app\n\n## Available commands\n\nTo execute an operation, run `poetry run anki-patcher \u003c--flags\u003e \u003ccommand\u003e`\n\n- `poetry run anki-patcher list`: lists all available patch operations\n- `poetry run anki-patcher patch -o \u003coperation\u003e -d \u003cdeck-name\u003e -c \u003cpath-to-config.yml\u003e `: executes the specified operation on all cards of the deck \n\n### Stock operations:\n\n- `add_image`: for each card of a deck, adds an image retrieved from google, based on another card field value ([example config](./example_configs/add_image_example.yml))\n  - use-case: add images to cards for language learning\n  - example-use: `poetry run anki-patcher patch -o add_image -d \"German::A1\" -c example_configs/add_image_example.yml`\n- `add_tts`: for each card of a deck, adds a text-to-speech audio file retrieved from google tts, based on another card field value ([example config](./example_configs/add_tts_example.yml))\n  - use-case: add tts to cards for language learning\n  - example-use: `poetry run anki-patcher patch -o add_tts -d \"German::A1\" -c example_configs/add_tts_example.yml`\n- `gpt`: for each card of a deck, adds a text generated by OpenAI GPT Api (e.g. gpt-4), based on another card field value ([example config](./example_configs/gpt_example.yml))\n  - use-case: add example sentences to cards\n  - example-use: `poetry run anki-patcher patch -o gpt -d \"German::A1\" -c example_configs/gpt_example.yml`\n- `replace`: for each card of a deck, replaces a substring of a field value with another string ([example config](./example_configs/replace_example.yml))\n  - use-case: replace a substring of a field value with another string\n  - example-use: `poetry run anki-patcher patch -o replace -d \"German::A1\" -c example_configs/replace_example.yml`\n- ... building more, contributions welcome!\n\n## Building your own operations\n\nIt's easy! \nJust create a new file in [operations](anki_patcher/patcher/operations/) with a `execute(card_id, fields, config)` function (see [add_image](anki_patcher/patcher/operations/add_image.py) for an example). Afterwards, the operation will be available to be executed via `poetry run anki-patcher patch -o \u003coperation\u003e -d \u003cdeck-name\u003e -c \u003cpath-to-config.yml\u003e `. To check if your operation is available, run `poetry run anki-patcher list`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexw00%2Fanki-patcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexw00%2Fanki-patcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexw00%2Fanki-patcher/lists"}