anki decks: add multiple-choice shapes variant; add real element photos to periodic table

shapes_mc (tools/anki-deck-visual.py) is the same shape images as
"shapes" but multiple choice instead of type-the-name, matching the
plain-text A/B/C/D pattern anki-deck-periodic.py's "category" deck
already uses (no clickable UI, since that needs a desktop-only Anki
add-on and breaks on AnkiDroid/AnkiMobile).

periodic prehs/hs (tools/anki-deck-periodic.py) now show each element's
real sample photo alongside every card, fetched once from Wikipedia's
own MediaWiki pageimages API and cached under tools/periodic_images/ —
the one part of this tooling that needs internet access at generation
time; --no-images restores the old text-only cards. Elements 100
(Fermium) through 118 (Oganesson) are excluded, since none has ever
existed in a photographable quantity — every fetch is otherwise
per-element and non-fatal, with progress printed so failures are visible.

This fetch logic could not be exercised against the real Wikipedia API
from this sandbox (no route to en.wikipedia.org here) — --dry-run-tts
now also substitutes a placeholder image so the pipeline is at least
structurally tested end to end. Real-network behavior needs verifying
on an actual run.

Added tools/*.apkg, tools/media_*/, tools/periodic_images/, and
tools/__pycache__/ to .gitignore — all generated/cached locally, never
meant to be committed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DyceEVVeQ33EeS6C1PDv5
This commit is contained in:
Claude
2026-09-10 14:20:24 +00:00
parent e4e32f20e7
commit 67282521ac
4 changed files with 203 additions and 18 deletions
+15 -2
View File
@@ -300,8 +300,12 @@ account has no content — `tools/anki-deck-math.py`,
`tools/anki-deck-periodic.py`, and `tools/anki-deck-visual.py` generate
ready-to-import `.apkg` decks (multiplication/division/addition/
subtraction/fractions/decimals, the periodic table, and shapes/clocks/
coin-counting) with Anki's built-in type-the-answer input and offline
neural TTS audio (Piper) on every card. All three are standalone Python
coin-counting) with offline neural TTS audio (Piper) on every card. Most
cards use Anki's built-in type-the-answer input; a few (periodic table
categories, `--deck shapes_mc`) are multiple choice instead, shown as
plain-text A/B/C/D options — type the letter rather than tapping, since a
clickable UI needs a desktop-only Anki add-on and would break on
AnkiDroid/AnkiMobile. All three are standalone Python
scripts, unrelated to the `services/*.sh` installer framework — run them
on any machine with Python, not necessarily the server itself. Full setup
(a venv, `genanki` + `piper-tts`, downloading a voice) and every deck's
@@ -317,6 +321,15 @@ because AnkiDroid has long-standing, still-open bugs rendering SVG
`<img>` tags on mobile; see `tools/anki-deck-visual.py`'s own docstring
for more on both tradeoffs.
The periodic table `prehs`/`hs` decks also show each element's real
sample photo (fetched once from Wikipedia's own MediaWiki API and cached
under `tools/periodic_images/`) alongside every card — the one part of
this tooling that needs internet access at generation time; pass
`--no-images` for the old text-only cards. Elements 100 (Fermium) through
118 (Oganesson) are skipped, since none has ever existed in a
photographable quantity. See `tools/anki-deck-periodic.py`'s own
docstring for the details and its caveats.
## Layout
```