matt-taylor.tech
← Back to projects

Open source

Subreddit Sounds

github.com/matt-taylor-tech/subreddit-sounds ↗

Python FastAPI SQLite SQLAlchemy 2.0 APScheduler Jinja2 Docker Reddit API Spotify API

I built Subreddit Sounds to turn music shared on Reddit into a Spotify playlist that refreshes daily. It runs unattended in a Docker container, and I listen to the resulting playlist while working and in the workshop.

What it does each day

  1. Pulls the top posts from the chosen subreddit(s), via Reddit's public RSS feed or the OAuth API if credentials are added.
  2. Resolves each post to a Spotify track. Direct Spotify links are taken as-is; YouTube links get their title and artist parsed (using the channel as an artist hint) and searched on Spotify. Results are filtered by genre and minimum duration, and full-album links are skipped.
  3. Optionally pulls Bandcamp new releases by tag.
  4. Reconciles the playlist to the latest N tracks (default 25), adding new finds and trimming the oldest, so it's a rolling, always-current playlist rather than an ever-growing dump.

Architecture

  • Backend: Python + FastAPI
  • Database: SQLite via SQLAlchemy 2.0 for run history and configuration
  • Admin UI: Server-rendered Jinja2 templates with login, a manual Run now trigger, and run-history pages with full per-run logs
  • Setup: Browser-based first-run wizard: credentials are entered in the UI, so no API keys live on disk
  • Auth: Single local admin login with passlib[bcrypt] and itsdangerous-signed sessions
  • Scheduler: APScheduler running an in-app daily job at a configurable time
  • HTTP: httpx for the Reddit, YouTube, Bandcamp, and Spotify calls
  • Deployment: Single-container Docker, runs on any Docker host
  • Testing: pytest

Maintaining it

Regular use gives me a reason to keep improving track matching, filters, and scheduled refreshes. The public repository includes the application and setup instructions.