Skip to content

MediaLibrary

Personal media tracking system with Spotify integration, Libby book imports, and a Personal API for cross-session AI context about reading and listening habits.

TypeScriptSQLiteSpotify APICLIPAI

MediaLibrary

A personal media tracking system that aggregates books, movies, TV shows, podcasts, music, and recipes into a single searchable database with AI-accessible context.

Overview

MediaLibrary was built to solve a specific problem: AI assistants have no persistent memory of what you’re reading, watching, or listening to. By tracking media consumption in a structured database exposed through MCP, every PAI session knows what books I’m currently reading and what music I listen to.

Key Features

  • Multi-source ingestion - Spotify listening history (automated via launchd), Libby/OverDrive CSV exports for library books, manual entries via CLI
  • Unified database - SQLite-backed storage for 375+ media items across all types
  • Personal API integration - MCP endpoints for current media, taste profiles, and recommendations
  • CLI management - Add, update, search, and browse media from the command line
  • Automated sync - Launchd-scheduled Spotify history imports every 6 hours

Architecture

Spotify API ──┐
Libby CSV ────┤──> CLI Ingest ──> SQLite DB ──> Personal API (MCP)
Manual entry ─┘                                  └──> AI Context

Integrations

Spotify Sync

Automated via launchd scheduler, pulls recent listening history and stores tracks with metadata (artist, album, play count, timestamps).

Libby/OverDrive Import

Parses CSV exports from the Libby library app, importing borrowed and completed books with metadata.

What I Learned

  • Spotify API rate limits - Need careful pagination and caching for listening history
  • Data normalization - Merging the same book from multiple sources (manual entry vs. Libby import) requires fuzzy matching
  • MCP as a personal data layer - Exposing personal data through MCP makes every AI session contextually aware