Skip to content

Add media recovery page - #1973

Merged
JeffreyCA merged 7 commits into
masterfrom
recovery-mode
Aug 21, 2026
Merged

JeffreyCA merged 7 commits into
masterfrom
recovery-mode

Conversation

@JeffreyCA

Copy link
Copy Markdown
Owner

Add a hidden /recovery page for rebuilding database entries from files remaining in the media directory, for recovering from database loss when the media files survived.

The scan endpoint parses upload and mix directories (whose names are the original UUID primary keys) and recovers metadata from audio tags and the metadata encoded in mix filenames. The page presents the results for review in two tabs: uploads are imported first with editable artist and title, then mixes are assigned to the recovered tracks, with placeholder tracks available for mixes whose original upload is gone. Files can be previewed by ear, including individual stems of dynamic mixes.

Recovery is best-effort and local storage only. Each item is imported in its own transaction and reported individually, and re-running skips anything already present.

Add a hidden /recovery page for rebuilding database entries from files
remaining in the media directory, for recovering from database loss when
the media files survived.

The scan endpoint parses upload and mix directories (whose names are the
original UUID primary keys) and recovers metadata from audio tags and the
metadata encoded in mix filenames. The page presents the results for
review in two tabs: uploads are imported first with editable artist and
title, then mixes are assigned to the recovered tracks, with placeholder
tracks available for mixes whose original upload is gone. Files can be
previewed by ear, including individual stems of dynamic mixes.

Recovery is best-effort and local storage only. Each item is imported in
its own transaction and reported individually, and re-running skips
anything already present.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Mix artist and title now always describe the mix file instead of mirroring
the selected source track, which made a wrong assignment impossible to spot,
and the source track dropdown is now sorted.

Scanning does fewer filesystem calls, and the gunicorn and nginx timeouts are
raised, since a large media directory on a slow bind mount exceeded the 30s
default.
The recovery scan filtered upload directories with VALID_FILE_EXT, which only
covers what users are allowed to upload directly. YouTube downloads live in the
same directory and are named after the format that was fetched, so anything
landing as .mp4 was silently skipped: the upload never appeared on the recovery
page, and the mixes made from it could not be assigned to any track. Recovery
now reads every extension yt-dlp can leave behind.

Those extensions were also unreliable. The name came from a separate extraction
that could resolve a different format than the one actually downloaded, leaving
files named for a format they did not contain. The output template now carries
%(ext)s and the stored path is taken from the file yt-dlp wrote, which removes
the need for get_file_ext.

Bump yt-dlp and pin yt-dlp-ejs so JS challenge solving works. Without it the
audio-only formats are dropped and 'bestaudio/best' falls back to a progressive
video stream.
@JeffreyCA
JeffreyCA marked this pull request as ready for review August 21, 2026 02:09
@JeffreyCA
JeffreyCA merged commit e8199da into master Aug 21, 2026
1 check passed
@JeffreyCA
JeffreyCA deleted the recovery-mode branch August 21, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant