Commit Graph
59 Commits
Author SHA1 Message Date
yonlu cb5155b890 feat(15-01): migrate FTS5 search_index to contentless_delete=1
- Add contentless_delete=1 to search_index.sql schema file
- Update ClearSearchIndex CREATE statement to match schema
- Replace DeleteSearchIndex no-op with real DELETE WHERE rowid
- Add migration 8: drop/recreate/repopulate FTS5 table
- Update library.go comment about FTS entry lifecycle
2026-03-16 18:10:57 -04:00
yonlu 9f595b7ac1 fix(13-02): resolve phantom playlist tracks using M3U8 paths after scan
- Add ScanHooks callback struct to library package (follows RemovalHooks pattern)
- Move phantom resolution from library to playlist service via hook
- New ResolvePhantomTracksAfterScan reads M3U8 files and resolves paths
  against current audio_files using multi-root resolution
- Handles pre-existing phantoms (match by M3U8 position) and new ones
  (match by phantom_file_path)
- Delete old resolvePhantomTracks method that required phantom_file_path
- Wire ScanHooks in app.go OnStartup
2026-03-16 12:47:42 -04:00
yonlu 93262b9ae0 fix(13-02): auto-resolve phantom playlist tracks after library scan
- Add phantom_file_path column to playlist_tracks (migration 7)
- Store original file_path during RemoveLibrary phantom metadata population
- After each successful scan, UPDATE phantom tracks whose phantom_file_path
  now matches an audio_files row, re-linking them and clearing phantom metadata
- Update schema file, sqlc generated code, and database test for new column
2026-03-16 12:29:06 -04:00
yonlu 5f7de5060a feat(13-01): add library-filtered Go query methods and FTS search
- GetAllTracksByLibrary, GetAllAlbumsByLibrary, GetAllArtistsByLibrary
- GetAlbumsByArtistByLibrary, GetAllGenresWithCountsByLibrary
- GetTracksByGenreByLibrary, GetAlbumTracksByLibrary
- SearchTracksByLibrary wraps SearchFTSTracksByLibrary on DB
- SearchFTSTracksByLibrary filters FTS results by library_id
2026-03-16 09:29:08 -04:00
yonlu 9144dedc27 fix(quick-19): multi-root path resolution for playlist M3U8 tracks
- Replace getLibraryRoot() with getAllLibraryRoots() returning all library paths
- Add resolveM3UPath() for multi-root resolution with knownPaths lookup
- Add toRelativePathMultiRoot() to save relative paths using correct root
- Update removeM3UEntries, replaceM3UEntryPaths, findM3UEntry for []string roots
- Update all 8 call sites in playlist.go for multi-root resolution
- Update existing test signatures for new []string parameter types
- Fix pre-existing golines formatting in scan_queue.go
2026-03-16 01:07:45 -04:00
yonlu ac8cbb3296 fix(12-02): serialize ScanWarning.Err as string instead of error interface
Go's error interface has no exported fields, so json.Marshal produced
{} for the error message. Converting to string at the addWarning call
site preserves the actual error text in the JSON payload.
2026-03-14 12:06:02 -04:00
yonlu 21ea71e257 perf(12-02): increase scan batch size from 50 to 300
Amortizes SQLite fsync cost over 6x fewer transactions. Cuts ~80
fsyncs for a 25K-track library — significant on HDD.
2026-03-14 11:33:03 -04:00
yonlu 30f4461e69 perf(12-02): skip FTS5 rebuild during library removal
Contentless FTS5 cannot delete individual rows, but stale entries are
filtered out by the JOIN against track_metadata in search queries.
The index is rebuilt on the next full rescan. Removes ~10s of overhead
for a 25K-track library removal.
2026-03-14 10:24:49 -04:00
yonlu 890284ddb1 fix(12-02): delete artist_credit_artist before artist_credit in removal pipeline
artist_credit_artist.credit_id references artist_credit.id, so the
child table must be cleaned before the parent. Same FK ordering fix
as the earlier recording_genres/recordings swap.
2026-03-14 10:15:37 -04:00
yonlu 1ad099a9d3 fix(12-02): soft scan claims orphaned library_id=0 tracks on startup
Tracks from the pre-multi-library schema have library_id=0 and aren't
counted by CountAudioFilesByLibrary, causing a permanent count mismatch
that triggers a full scan on every launch. SoftScanAllLibraries now
claims matching orphans before comparing counts.
2026-03-13 13:59:18 -04:00
yonlu 92c4d23a9a fix(12-02): soft scan on launch — only scan libraries with changed file counts
SoftScanAllLibraries compares audio file count on disk vs DB track count
per library. Unchanged libraries are silently skipped (no progress bar,
no events). Only libraries where files were added or removed since the
last scan get queued for a full scan.
2026-03-13 13:53:46 -04:00
yonlu 1d735c3a5f fix(12-02): reorder orphan cleanup to delete FK children before recordings
recording_genres and release_group_recordings reference recordings.id,
so they must be deleted BEFORE the recordings table is cleaned.
Also extends toast duration to 8s for readability.
2026-03-13 13:38:39 -04:00
yonlu cf004986c9 fix(12-02): wait for scan to stop before library removal, surface errors in UI
RemoveLibrary now polls until the cancelled scan goroutine finishes
before proceeding with the removal transaction. Also show removal
errors as toast messages instead of only logging to console, and
explicitly reload library list after successful removal.
2026-03-13 11:17:37 -04:00
yonlu f60b6b5255 fix(12-02): claim orphaned tracks when adding library with matching path
Tracks from pre-multi-library schema have library_id=0 (default).
When AddLibrary creates a new library row, UPDATE orphaned tracks
whose file_path falls under the library's directory to use the new
library_id. This prevents the scan from hitting UNIQUE constraints
on every file and ensures track counts are correct immediately.
2026-03-13 10:50:34 -04:00
yonlu 13a42aea22 feat(12-02): selectable library list with checkbox scan targeting
- Add checkboxes to library list with select-all header
- Soft Scan operates on selected libraries (queues each individually)
- Full Rescan stays global (nukes all data, rescans all libraries)
- Remove redundant 'Scan All Libraries' button
- Fix FullRescan Go backend to scan all libraries after wipe, not just first
2026-03-13 10:33:15 -04:00
yonlu b36e472212 fix(12-02): count failed saves as skipped so scan progress bar advances
Files that fail to save (e.g. UNIQUE constraint from pre-existing
tracks with a different library_id) were not counted in any progress
counter, leaving the progress bar stuck at 0%. Now increments skipped
so processed = added + skipped + updated reflects all files visited.
2026-03-13 09:31:28 -04:00
yonlu cf18c39dbd fix(12-02): downgrade per-file save error to Debug, add warning count to scan summary 2026-03-13 09:17:38 -04:00
yonlu ffc5d9639c feat(12-02): replace config-page library section with full library management UI
- Add library list with name, path, track count per library
- Add Library button opens folder picker, auto-creates library
- Inline rename with Enter/Escape via overflow menu
- Removal confirmation dialog with real impact counts (tracks, playlists, queue)
- Toast notification with removal summary after library removal
- Add GetAllLibrariesWithTrackCounts + Info type to backend Library struct
- Add Wails binding stubs for AddLibrary, RenameLibrary, RemoveLibrary, GetRemovalImpact
- Add Info, RemovalImpact, RemovalSummary types to models.ts
- Remove old single-directory library config UI (GetLibraryDirectory/SetLibraryDirectory)
2026-03-12 19:50:59 -04:00
yonlu bd44f8306c feat(12-01): implement library CRUD methods and orphan cleanup pipeline
- Add AddLibrary, RenameLibrary, RemoveLibrary, GetRemovalImpact methods
- RemoveLibrary follows exact order: phantom populate → delete audio_files → orphan cleanup → commit → FTS5 rebuild → cover art file cleanup → queue compact → events
- Add cancelLibraryScan and currentTrackBelongsToLibrary helpers
- Add RemovalHooks type and removalHooks field on Library struct
- Add LibraryAdded, LibraryRenamed, LibraryRemoved event constants
- Regenerate frontend events.ts with new CRUD events
- All hand-crafted SQL has SAFETY comments per project convention
- Dual artist_credit FK check (recordings + release_groups) for orphan cleanup
2026-03-12 19:37:07 -04:00
yonlu 1aaf53630d docs(11-02): complete frontend scan UI plan
- SUMMARY.md documents per-library progress display and queue-aware cancel dialog
- STATE.md updated: plan 2/3, session continuity, new decisions
- ROADMAP.md updated: phase 11 progress 2/3
- REQUIREMENTS.md: LSCAN-03 marked complete
2026-03-09 16:13:45 -04:00
yonlu 943db1cf27 feat(11-01): per-library scan pipeline with queue coordinator
Task 1: Schema, events, and progress types
- Add library_id to CreateAudioFile SQL INSERT and regenerate sqlc code
- Add LibraryScanQueued and LibraryScanQueueDrained event constants
- Regenerate TypeScript events via genevents
- Add LibraryID, LibraryName, QueuedCount to ScanProgress
- Add LibraryID, LibraryName to ScanMetrics
- Add libraryID field to importResult for threading through pipeline

Task 2: Scan queue coordinator and per-library scanning
- Create scan_queue.go with ScanLibrary(id), ScanAllLibraries()
- Add CancelCurrentScan(), CancelAllScans() for queue-aware cancellation
- FIFO scan queue with silent dedup (same library already scanning or queued)
- Refactor Scan() -> scanInternal(libraryID, libraryName, libraryPath)
- Replace GetAllAudioFiles with GetAudioFilesByLibrary for per-library loading
- Thread libraryID through DB writer to set CreateAudioFileParams.LibraryID
- drainQueue auto-starts next queued library or emits LibraryScanQueueDrained
- Pause freezes current scan AND queue
- Add GetScanQueueLength() and QueuedLibraryNames() for UI
- Mark CancelScan() and Scan() as deprecated
2026-03-09 16:02:54 -04:00
yonlu 6285ca9dc4 feat(09-02): add shortcuts config package with default bindings and Wails persistence
- Create backend/shortcuts/config.go with DefaultBindings(), ApplyDefaults(), Validate()
- Wire Shortcuts field into main Config struct with TOML persistence
- Add GetShortcuts, SetShortcuts, SetShortcut, ResetShortcuts Wails binding methods
- Regenerate Wails TypeScript bindings for new config methods
- Fix wsl lint in library.go (blank line before logger call)
2026-03-06 21:46:09 -05:00
yonlu cf22e52a64 feat(09-01): add scan control fields and per-scan cancellable context
- Add scanActive, scanCancel, scanPaused, scanPauseCh fields to Library struct
- Create scan_control.go with CancelScan, PauseScan, ResumeScan, IsScanActive, IsScanPaused
- Thread per-scan scanCtx through walk and worker pipeline
- Add waitIfPaused checkpoint before each worker extraction
- Skip orphan cleanup and variant generation on cancelled scan
- Emit LibraryScanCancelled instead of LibraryScanComplete when cancelled
2026-03-06 21:30:49 -05:00
yonlu c695024241 feat(09-01): add scan control events and cancelled metrics field
- Add LibraryScanCancelled, LibraryScanPaused, LibraryScanResumed events
- Regenerate frontend/src/events.ts via go generate
- Add Cancelled bool field to ScanMetrics struct
2026-03-06 21:28:37 -05:00
yonlu e1a95e65a9 fix(quick-13): resolve lint issues in main source files
- Fix errcheck for db.Close() in testhelper.go
- Fix errcheck, nlreturn, wsl, gofumpt issues in genevents/main.go
- Fix gofumpt and wsl issues in library.go
2026-03-05 14:07:50 -05:00
yonlu 97f256d67f fix: include full track metadata in GetAudioFilesByReleaseGroup query
The GetAudioFilesByReleaseGroup SQL query only selected 6 columns,
missing audio properties (sample_rate, bit_depth, channels, bitrate,
file_size) and metadata (album, genre, year, composer, file_type).
This caused track details opened from the album view to show dashes
instead of actual values. Expanded the query to match
GetAllTracksWithFullMetadata and updated GetAlbumTracks to use the
shared mapTrackRow helper.
2026-03-05 13:34:03 -05:00
yonlu a28b4d1e06 feat: add scan progress bar with phase indicator
Add live progress reporting during library scans:

- Pre-walk count: fast WalkDir to count audio files upfront for
  percentage calculation (~1-2s overhead)
- Progress ticker: emits ScanProgress events every 300ms with
  phase, file counts (added/skipped/updated), and total
- Phase labels: counting → scanning → thumbnails → orphans
- Frontend: progress bar with percentage, file counts breakdown,
  and phase indicator in both config-page and library-manager

Replaces the static 'Scanning...' text with a live progress bar
showing e.g. '62% — Scanning... 1,247 / 2,013 files (891 new,
356 skipped)'
2026-03-05 11:21:53 -05:00
yonlu 8e9a616037 fix: drop+recreate contentless FTS5 index instead of DELETE
The search_index is a contentless FTS5 table (content=''), which
SQLite does not support DELETE on. ClearSearchIndex now drops and
recreates the virtual table. Single-row DeleteSearchIndex becomes
a no-op since contentless FTS5 also cannot delete individual rows;
stale entries are harmless (search JOINs filter them out) and the
index is fully rebuilt during FullRescan.
2026-03-05 10:41:55 -05:00
yonlu d43ba7bd0c fix(quick-10): add migration 5 and fix entity cache for composite album key
- Migration 5 rebuilds release_groups with UNIQUE(name, album_artist_credit_id)
- Drops and recreates track_metadata VIEW during table rebuild
- Temporarily disables FK checks for safe table rebuild
- Entity cache now keys by album name + artist credit ID
- Update tests to use composite cache keys
2026-03-05 10:25:53 -05:00
yonlu 7dfe003e63 docs(06-03): add SAFETY comments to all 12 hand-crafted SQL statements
- 7 SAFETY comments in search.go (FTS5 MATCH/INSERT/DELETE operations)
- 3 SAFETY comments in library.go (FTS5 INSERT/DELETE in commitNewAudioFile, updateAudioFileMetadata)
- 1 SAFETY comment in rescan.go (FTS5 DELETE in clearAllLibraryData)
- 1 SAFETY comment in persistence.go (variable-count multi-row INSERT)
- Cross-references link library.go/rescan.go back to search.go
- Two-part format: why sqlc can't handle it + what makes it safe
2026-03-04 19:33:55 -05:00
yonlu fa6c378e25 test(05-02): add entity cache and orphan cleanup tests with DB backing
- TestCachedUpsertArtistCredit: cache hit returns same ID on second call
- TestCachedLinkArtist: skips duplicate INSERT via linkedCredits cache
- TestCachedLinkArtist_MultiCredit: same artist linked to different credits
- TestCachedUpsertGenre: genre cache returns same ID on repeated calls
- TestResolveReleaseGroup: creates release group, updates cover art on cache hit
- TestResolveReleaseGroup_CacheHit: pre-populated cache returns cached ID
- TestOrphanDeletion: DeleteAudioFile removes row, documents contentless FTS5 limitation
- TestEntityCache_EmptyFields: empty artist name, empty album, AlbumArtist reuse
2026-03-04 16:37:48 -05:00
yonlu 6f96a9411f test(05-02): add pure helper tests for scan utility functions
- TestGetRecordingName: title present, fallback to filename sans extension
- TestToNullInt64: zero as null, positive/negative as valid
- TestToNullString: empty as null, non-empty as valid
- TestSplitGenres: empty/single/multiple genre splitting on || delimiter
- TestMapTrackRow: all 16 columns including string TrackLength, NullInt64 fields
2026-03-04 16:35:00 -05:00
yonlu f9b2ad95b7 test(04-02): add config and sub-config validation tests
- Theme: hex color regex + background shade enum validation
- Tracklist: column ID recognition + duplicate detection
- Favorites: icon style enum validation
- Library: directory existence + scan concurrency mode validation
- Config: load/save roundtrip, missing file handling, composed errors, defaults
2026-03-03 17:00:12 -05:00
yonlu e6866ded9d feat(02-02): add ScanWarning type and reclassify scan errors as warnings
- Add ScanWarning struct with FilePath/Phase/Err to ScanMetrics
- Add mutex-protected addWarning method for concurrent use
- Reclassify walk, extraction, commit, orphan, variant, FTS failures as warnings
- Update commitBatch to return only fatal tx.Commit errors
- Update cachedLinkArtist to check errors via database.IsUniqueViolation
- Update handleConfigUpdate to capture and log scan warning count
2026-03-02 19:18:11 -05:00
yonlu daaa6b7f97 fix(01-01): add mutex protection to Queue, Library, and Playlist SetContext methods
- Queue.SetContext acquires existing q.mu before writing q.ctx
- Library struct gets new mu sync.Mutex; SetContext and SetRescanHooks acquire it
- Playlist Service struct gets new mu sync.Mutex; SetContext and SetFavoritesConfig acquire it
- Library and Playlist release lock before calling post-init methods (registerEventHandlers, migrateExistingPlaylists)
2026-02-28 12:09:14 -05:00
yonlu baa4644ece extracted cover art handling from library package 2026-02-25 15:31:05 -05:00
yonlu e192d4625e playlist phantom track matching added, updated search queries for efficiency 2026-02-24 21:23:25 -05:00
yonlu ff7649600b refactored full rescan to use hook/lifecycle pattern and added rescan package 2026-02-24 16:11:41 -05:00
yonlu 16060023bb audio file info added, fixed right click selecting. 2026-02-23 19:05:57 -05:00
yonlu 9dabfb81c5 beginnings of artist grid and artist details view 2026-02-22 19:17:27 -05:00
yonlu 9cb1c6674a changed genre scanning to parse multiple genres, updated db to accommodate. 2026-02-22 13:59:28 -05:00
yonlu b5e70a8ce6 user can configure visible columns in track-list 2026-02-22 11:24:19 -05:00
yonlu 88c3736110 added color/ theme settings, new config window 2026-02-20 14:43:35 -05:00
yonlu 560ab3a3b5 playlists now save to files, can be restored from files 2026-02-19 23:10:20 -05:00
yonlu d9ebd38382 configurable scan parallelism based on hdd or sdd 2026-02-19 13:59:02 -05:00
yonlu 81793975b4 improved library scan speeds, added library manager component
-libraries tab now opens a library manager
-choose library directory, manually soft scan and rescan
-batched db queues
-mp3 header-based duration extraction
2026-02-19 10:17:09 -05:00
yonlu c9e78c491c cover-grid album dropdown behavior fixes 2026-02-18 11:34:10 -05:00
yonlu 481beca00a frontend changes
-smaller thumbnails
-GPU acceleration
-lazy loading/ rendering only visible elements
-cover grid shows album tracks on click
2026-02-16 22:42:13 -05:00
yonlu 176b32fb0d frontend fixes
album artist gets populated with artist as fallback (frontend also uses
this as display name fallback for albums). added scroll position
persistence when switching main views. also added frontend cache for
faster switching.
2026-02-16 14:38:09 -05:00
yonlu 67cea5cfb0 fixed player behavior after final queue track completes, added click to play from queue window 2026-02-15 16:20:56 -05:00