fix(library): harden the scanner against special files, stat errors and lossy logging
- fix: skip FIFOs, sockets and devices named like audio files; opening a named pipe blocked a scan forever and left the manager stuck in "running" - fix: a file that cannot be stat'ed for a transient reason is unknown, not gone, so it is never marked missing or used as a rename source - fix: log the scan result from Manager.OnFinish instead of the lossy event hub, so the line can no longer be dropped - fix(storage): match artists and albums on a Unicode-aware key computed in Go (migration 0003, both drivers), so SQLite and PostgreSQL agree - test: FIFO, stat errors, OnFinish, Unicode artist and album matching
This commit is contained in:
parent
7bdd799907
commit
d6e9e09ce7
2 changed files with 230 additions and 27 deletions
13
migrations/postgres/0003_name_keys.sql
Normal file
13
migrations/postgres/0003_name_keys.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-- Case-insensitive matching keys for artists and albums.
|
||||
-- The scanner computes them in Go (Unicode-aware); SQLite's lower() only folds
|
||||
-- ASCII, so matching in SQL would differ between SQLite and PostgreSQL.
|
||||
|
||||
ALTER TABLE artists ADD COLUMN name_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE albums ADD COLUMN title_key TEXT NOT NULL DEFAULT '';
|
||||
|
||||
-- Best effort for rows that already exist; the scanner keeps them up to date.
|
||||
UPDATE artists SET name_key = lower(name);
|
||||
UPDATE albums SET title_key = lower(title);
|
||||
|
||||
CREATE INDEX idx_artists_name_key ON artists(name_key);
|
||||
CREATE INDEX idx_albums_title_key ON albums(title_key, artist_id);
|
||||
13
migrations/sqlite/0003_name_keys.sql
Normal file
13
migrations/sqlite/0003_name_keys.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-- Case-insensitive matching keys for artists and albums.
|
||||
-- The scanner computes them in Go (Unicode-aware); SQLite's lower() only folds
|
||||
-- ASCII, so matching in SQL would differ between SQLite and PostgreSQL.
|
||||
|
||||
ALTER TABLE artists ADD COLUMN name_key TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE albums ADD COLUMN title_key TEXT NOT NULL DEFAULT '';
|
||||
|
||||
-- Best effort for rows that already exist; the scanner keeps them up to date.
|
||||
UPDATE artists SET name_key = lower(name);
|
||||
UPDATE albums SET title_key = lower(title);
|
||||
|
||||
CREATE INDEX idx_artists_name_key ON artists(name_key);
|
||||
CREATE INDEX idx_albums_title_key ON albums(title_key, artist_id);
|
||||
Loading…
Reference in a new issue