feat(catalog): add the read API for artists, albums and tracks
- feat(api): GET /api/v1/artists, /albums and /tracks with q (case and accent
insensitive substring), limit and offset (default 50, at most 200) and a
total; filters library_id, artist_id and album_id; GET /artists/{id},
/albums/{id} and /tracks/{id}; any signed-in user can read
- feat(catalog): only tracks with a file that is not flagged missing are
visible, so everything shown can be played; a track with several files is
listed once; album artists without credited tracks (compilations) are listed
- feat(storage): results are ordered the same way on SQLite and PostgreSQL
(plain byte order), LIKE wildcards in the search text are escaped, and a
page costs a fixed number of queries: related items and counts are loaded in
batches
- feat(storage): tracks get a title_key computed in Go (migration 0006, with
a startup refresh), like artists and albums
- test: ordering, paging, search with accents and wildcards, library filter,
duplicate encodings, missing files, details, and a query-count guard on
both databases
This commit is contained in:
parent
a28d028a67
commit
e14c523828
2 changed files with 1821 additions and 5 deletions
7
migrations/postgres/0006_track_title_key.sql
Normal file
7
migrations/postgres/0006_track_title_key.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- Case-insensitive search key for track titles, computed in Go like the artist
|
||||
-- and album keys (SQL lower() folds different characters on SQLite and PostgreSQL).
|
||||
|
||||
ALTER TABLE tracks ADD COLUMN title_key TEXT NOT NULL DEFAULT '';
|
||||
|
||||
-- Best effort for existing rows; RefreshMatchKeys corrects them at startup.
|
||||
UPDATE tracks SET title_key = lower(title);
|
||||
7
migrations/sqlite/0006_track_title_key.sql
Normal file
7
migrations/sqlite/0006_track_title_key.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- Case-insensitive search key for track titles, computed in Go like the artist
|
||||
-- and album keys (SQL lower() folds different characters on SQLite and PostgreSQL).
|
||||
|
||||
ALTER TABLE tracks ADD COLUMN title_key TEXT NOT NULL DEFAULT '';
|
||||
|
||||
-- Best effort for existing rows; RefreshMatchKeys corrects them at startup.
|
||||
UPDATE tracks SET title_key = lower(title);
|
||||
Loading…
Reference in a new issue