feat(webui): bulk album delete + Lidarr re-download completion tracking#20
Merged
feat(webui): bulk album delete + Lidarr re-download completion tracking#20
Conversation
Adds a whole-folder delete path to the WebUI with async job tracking so users can purge up to 50 corrupt albums in one pass without the browser hanging. Deletes are staggered album-by-album (30s between each) to avoid flooding Lidarr and indexers, matching the existing auto-delete pipeline. Also adds a pending-redownload tracker: after any Lidarr-backed delete, BeatsCheck records the affected album IDs and checks Lidarr history at the start of the next scan cycle. Successful grabs are logged to beats_check.log so users can confirm re-downloads landed without tailing Lidarr's own logs. Stale entries time out after 24h. WebUI changes: - Per-album row: new "Delete Album" button (whole folder); dropped the redundant "Re-download" button (it was identical to Delete under the hood since Lidarr auto-searches monitored albums after any trackfile deletion). - Bulk "Delete Albums (Whole)" button with a 50-album cap. - "Select N" helper (number input + button) to fill the first N visible album checkboxes, respecting the search filter. - Progress modal polls /api/delete-job-status every 2s, shows current album + phase (running / waiting / done / cancelled), and supports mid-flight cancel. Backend changes: - main.py: delete_album_folders() with mount-root, MUSIC_DIR, and symlink guards; factored _delete_one_folder, _stagger_sleep, _validate_delete_folders, _finalize_delete_state helpers to keep cyclomatic complexity under the project cap. - main.py: _record_pending_redownloads / _poll_pending_redownloads hooked into the scan-loop start; integrated with delete_corrupt_files and run_auto_delete so every Lidarr delete path records grabs. - webui.py: POST /api/delete-albums (202 + job_id, fire-and-forget), GET /api/delete-job-status, POST /api/delete-job-cancel; in-memory job store with 1h auto-prune; .scanning lock held for the duration of a bulk delete so scans can't collide. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2b0a215 to
7bbfa29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LIDARR REDOWNLOAD: <artist> — <album> — grabbed (1 report)tobeats_check.log. Stale entries time out after 24h./api/delete-job-statusevery 2s, shows current album + phase (running/waiting/done/cancelled), supports mid-flight cancel.Backend
main.py—delete_album_folders()with mount-root,MUSIC_DIR, and symlink guards; factored into_delete_one_folder,_stagger_sleep,_validate_delete_folders,_finalize_delete_statehelpers to stay under the project's complexity cap.main.py—_record_pending_redownloads/_poll_pending_redownloadshooked into the scan-loop start; integrated withdelete_corrupt_filesandrun_auto_deleteso every Lidarr delete path records grabs.webui.py—POST /api/delete-albums(202 +job_id, fire-and-forget) /GET /api/delete-job-status/POST /api/delete-job-cancel; in-memory job store with 1h auto-prune;.scanninglock held during bulk delete so scans can't collide.New state files
pending_redownloads.json— tracks{albumId: {deletedAt, albumName, monitored}}. Auto-created; pruned as grabs are detected.Test plan
docker build -t beatscheck .corrupt.txthas entries across multiple albums.LIDARR DELETE: ....currentfolder label updates; Cancel mid-flight leaves the remaining albums untouched..scanninglock exists)./api/delete-albums.pending_redownloads.jsongets an entry. On the next scan cycle, confirmbeats_check.loggets aLIDARR REDOWNLOAD: ... — grabbed (1 report)line once Lidarr grabs a replacement./api/delete-albumswith a folder outsideMUSIC_DIR, a symlinked folder, andMUSIC_DIRitself.flake8 . --max-complexity=25 --max-line-length=127clean.🤖 Generated with Claude Code