fix: scan order, cancel bug, live library size, status colors#4
Merged
fix: scan order, cancel bug, live library size, status colors#4
Conversation
os.walk() returns directories in filesystem order (inode order on ext4/btrfs), which appears random. Sort dirs in-place so the scan progresses alphabetically through the library. https://claude.ai/code/session_011hPW1eEc8njbo1xUNXuci4
Cancel scan: beats_check.py runs as __main__ but webui.py reimports it as a separate 'beats_check' module via `from beats_check import cancel_scan`. This creates two copies of the module with separate `scan_cancelled` globals, so the cancel flag never reaches the running scan loop. Fix by registering __main__ as 'beats_check' in sys.modules at startup. Library size: calculated at scan start but only written to summary.json at scan completion. Push library_size_human and library_files to AppState immediately and merge them into the /api/status response so the dashboard shows the value as soon as file collection finishes. Status card: the dashboard STATUS card showed plain text with no color coding. Add status-based CSS classes (green idle, yellow scanning, etc.) to the card value element. https://claude.ai/code/session_011hPW1eEc8njbo1xUNXuci4
4 tasks
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
dirsin-place duringos.walk()so scans progress alphabetically by artist folder instead of random filesystem (inode) orderbeats_check.pyruns as__main__but webui reimports it as a separatebeats_checkmodule viafrom beats_check import cancel_scan, creating two copies with separatescan_cancelledglobals — the cancel flag never reached the running scan loop. Fixed by registering__main__asbeats_checkinsys.modulesat startupsummary.jsonat completion. Now pushed to AppState immediately and merged into/api/statusso the dashboard shows it as soon as file collection finishesTest plan