← All projects
songdeck
A Python program that turns a Spotify playlist into an Anki deck that teaches you to name each song from its first 10 seconds, hum how it starts, and say who made it. One command builds the whole deck. A friend uses it for his own playlist.
Why
I wanted to name songs from their intros the way you'd recall vocabulary. Spaced repetition makes that possible, but making the cards by hand takes hours, so I automated it.
How it works
- Read. Pulls a playlist through the Spotify API (OAuth login), or reads an exported CSV. It repairs malformed rows instead of dropping songs.
- Pick. A
pick command ranks songs across all 183 of my playlists by how many of them each song is in, plus my listening history. That's how my ~300-song "Favorites" deck was chosen.
- Match. Finds each song on YouTube and checks that the length, title and artist all match Spotify's.
- Clip. Downloads in parallel, trims leading silence, evens out volume and cuts the intro.
- Build. Generates the deck with several card types (intro → title, title → hum it, title → artist) and spreads new cards out so a day's review stays manageable.
What I learned
- Checking length isn't enough. The first version matched videos by length only, and it linked a song to a different song by the same band that happened to run the same length. I added strict title and artist matching and tested it against 23 real cases.
- Long jobs fail halfway. Every step is cached, so a rerun only does new songs. A dropped connection pauses the build instead of corrupting it.
- Setup is part of the product. I cut the setup from Homebrew, ffmpeg and a virtual environment down to
uv with bundled ffmpeg, so a friend could install it in about 20 minutes.