Skip to main content

Build Anki flashcard decks for bird identification from allaboutbirds.org

Project description

AviAnki

PyPI Python License Stars Ruff

Builds Anki flashcard decks for learning to identify birds by sight and sound. Cards are sourced from allaboutbirds.org and include photos, call/song audio, and species descriptions.

Each species generates two card types:

  • Photo → Name — given two photos and audio, identify the bird
  • Description → Name — given audio and a written description, identify the bird

Card examples

Photo → Name — identify the bird from photos and audio:

Photo → Name front

Description → Name — identify the bird from audio and a redacted description:

Description → Name front

Answer — reveals the name, scientific name, photos, audio, and full description:

Answer

Prerequisites

  • uv — for running and installing
  • ffmpeg — for trimming audio clips

Install ffmpeg:

# Windows
winget install ffmpeg

# macOS
brew install ffmpeg

Usage

From PyPI (recommended):

uvx avianki LOCATION [OPTIONS]

From a local clone:

git clone https://github.com/Ian-Costa18/avianki.git
cd avianki
uv run avianki LOCATION [OPTIONS]

Configuration

Copy .env.example to .env and fill in your key:

EBIRD_API_KEY=your_key_here

An eBird API key is only required if using an eBird region code as the location. Get one free at ebird.org/api/keygen.

Location formats

allaboutbirds.org browse URL (recommended — species sorted by local frequency):

  1. Go to allaboutbirds.org/guide/browse
  2. Under Birds Near Me, enter your city, ZIP code, or state/province
  3. Set the time of year — Year-round is recommended for a complete deck
  4. Click Browse, then copy the URL from your browser's address bar
uvx avianki "https://www.allaboutbirds.org/guide/browse/filter/loc/ChIJGzE9DS1l44kRoOhiASS_fHg/date/all/behavior/all/size/all/colors/all/sort/score/view/list-view"

Google Place ID (shorthand for the above):

uvx avianki ChIJGzE9DS1l44kRoOhiASS_fHg

Find a Place ID at developers.google.com/maps/documentation/javascript/examples/places-placeid-finder.

eBird region code (species in taxonomic order, requires API key):

uvx avianki US-MA
uvx avianki US-MA-017   # county level

Options

Flag Short Description
--limit N -n Cap the number of species included in the deck
--output FILE -o Output .apkg path (default: auto-generated from location)
--deck-name NAME -d Override the deck name shown in Anki
--no-audio -A Skip downloading call and song audio
--no-images -I Skip downloading photos
--delay SECONDS -D Wait between requests in seconds (default: 0.5)
--work-dir DIR -w Directory for cached media and logs (default: <tmp>/avianki/)
--media-dir DIR -m Override media subdirectory (default: <work-dir>/media/)
--ephemeral -e Use a temporary work dir and delete everything after packaging
--no-cache -X Skip cache lookup; delete downloaded media after packaging
--log-file FILE -l Log file path (default: <work-dir>/avianki.log)
--verbose -v Show debug-level output in the console
--quiet -q Only show warnings and errors in the console

Examples

# Build a deck for your area (recommended approach)
uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --limit 50

# Re-download all media from scratch
uvx avianki US-MA --clear-cache

# Quick test with 5 species
uvx avianki US-MA --limit 5

# Custom output path and deck name
uvx avianki US-MA --output ~/Desktop/MyBirds.apkg --deck-name "My Birds"

# Images only, no audio
uvx avianki US-MA --no-audio

# Be polite to the server
uvx avianki US-MA --delay 1.5

Output

An .apkg file is written to the current directory (e.g. Birds_US-MA.apkg). Import it into Anki via File -> Import.

Downloaded images and audio are cached in the system temp directory (<tmp>/avianki/media/ by default, or the directory set by --media-dir) so re-runs skip already-fetched files. The log is written to <tmp>/avianki/avianki.log.

Notes

  • Audio clips are trimmed to 10 seconds via ffmpeg to keep file sizes small.
  • allaboutbirds.org browse URLs sort species by likelihood score for your location, which gives much better study order than eBird's taxonomic ordering.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avianki-0.6.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avianki-0.6.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file avianki-0.6.0.tar.gz.

File metadata

  • Download URL: avianki-0.6.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for avianki-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e4afcdc4cee7564d2998840139ab2a74218a93319fd2cb34d1749b308196d9a2
MD5 e30a3147eac6b06988b4f1539bd16d4c
BLAKE2b-256 d9163d274b28db3c9570c5b199b4cbcbcffd8cad4e74023c8bd7ca105902dafe

See more details on using hashes here.

File details

Details for the file avianki-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: avianki-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for avianki-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa056886e7f9a5042f1327ba26f11f98b25c9b03d0d862fc01520339b571d420
MD5 a371d0fcbb79ca6491de54fc93c2ce48
BLAKE2b-256 fb0a8dfc5d290988cbfe668bebc30fed7e6542b74152db6443c49673cc061a8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page