Private Media Library
A private streaming service I built and run myself: films, TV, music and audiobooks served from files on disk, with a player that recovers when iOS gets playback wrong and a pipeline that repairs bad files before anyone presses play.
- films in the catalog
- 500
- TV series with season navigation and saved progress
- 23
- streams re-encoded when a copy will do
- 0
Media library screens
More previews (4)
The problem
Off-the-shelf media servers wanted a database, a scraper and their own idea of how my library should be organized. Files that played on a desktop stalled on a phone, and iOS would show a seek that never actually happened.
What changed
I built the whole stack instead. A guarded ingest turns the files into searchable catalogs, authenticated endpoints stream them, and a scheduled pipeline repairs incompatible files before playback. The same app now hosts my private Wisdom library browser, with day and night themes and phone layouts sized for touch.
How it's built
- Role
- Application architecture, implementation and operations
- Web stack
- PHP, JavaScript, JSON catalogs, Caddy
- Processing stack
- Python, SQLite, FFmpeg / ffprobe, systemd
- Status
- In daily use, with scheduled compatibility repair
Catalog updates that protect the library
Ingest preserves existing metadata, fills in new titles from OMDb, and reports additions, updates and removals in a dry run. Before a commit it verifies mounted libraries by sentinel files and device IDs, snapshots the generated catalogs and artwork, and refuses a change that would remove too much at once.
Authenticated streaming
PHP endpoints check the session and constrain each resolved path to its expected root. HTTP byte ranges let a browser seek without loading a whole file into memory. Read-only endpoints release the PHP session lock before file work, so artwork, scripts and media load in parallel.
Browsing and playback
Viewers search and filter a category, expand a season or open a nested audio collection, with breadcrumbs that follow a playlist as it advances. The interface restores filters and playback position, and a keyboard-accessible History drawer reopens recent items. Audio and video share playlists, saved position and one set of controls that works with mouse, touch, keyboard and a DualSense controller. Series can skip marked intros and outros.
Recovering a failed seek on iOS
On iOS the seek bar could move while the media kept playing from the start. The player now verifies that every seek landed. If one fails, it reloads the media element, waits for the requested range to become seekable and restores the position before resuming. New input cancels a recovery in progress.
Repairing files before playback
A scheduled Python scanner finds incompatible or poorly interleaved video and queues stable files in SQLite. A systemd worker runs one job at a time: FFmpeg copies compatible streams into a fast-start MP4 and converts only the streams that need it. The worker checks codecs, timing, chapters and stream layout, verifies copied streams by hash, and publishes the replacement atomically after disk, mount and collision checks.
Conversion and catalog ingest keep separate checkpoints, so a failed ingest can catalog the repaired file without encoding it again. Both stages cap attempts and keep evidence on failure.
The library runs on the same home hosting platform as this portfolio.