testsAndMisc-archive/python_pkg/anki_decks/warsaw_districts/run.sh
Krzysztof kuhy Rudnicki fe2c6628e2 Consolidate all Anki deck generators into python_pkg/anki_decks/
Move warsaw_bridges, warsaw_districts, warsaw_landmarks, warsaw_metro,
warsaw_osiedla, warsaw_streets, and car_brand_logos into the existing
python_pkg/anki_decks/ directory alongside the polish_* generators.

Also move preview_all.html into anki_decks/.

Update all import paths, filesystem references in geo_data.py,
docstrings, READMEs, test imports, and .gitignore accordingly.
2026-02-07 15:32:23 +01:00

57 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Script to set up environment, install dependencies, and generate Warsaw Districts Anki deck
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
PREVIEW_DIR="$SCRIPT_DIR/preview_images"
echo "=== Warsaw Districts Anki Generator ==="
echo
# Create virtual environment if it doesn't exist
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi
# Activate virtual environment
echo "Activating virtual environment..."
source "$VENV_DIR/bin/activate"
# Install dependencies
echo "Installing dependencies..."
pip install --quiet --upgrade pip
pip install --quiet matplotlib genanki geopandas
# Export preview images
echo
echo "Exporting preview images to $PREVIEW_DIR..."
mkdir -p "$PREVIEW_DIR"
cd "$SCRIPT_DIR"
python -c "
from warsaw_districts_anki import WARSAW_DISTRICTS, generate_district_image_bytes
from pathlib import Path
preview_dir = Path('$PREVIEW_DIR')
for district in WARSAW_DISTRICTS:
filename = district.replace(' ', '_').replace('-', '_') + '.png'
filepath = preview_dir / filename
filepath.write_bytes(generate_district_image_bytes(district))
print(f' Exported: {filename}')
"
echo
echo "Preview images exported! Check: $PREVIEW_DIR"
# Generate Anki deck
echo
echo "Generating Anki flashcards..."
python -m warsaw_districts_anki --output warsaw_districts.apkg
echo
echo "Done!"
echo " - Preview images: $PREVIEW_DIR"
echo " - Anki deck: $SCRIPT_DIR/warsaw_districts.apkg"