Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for sorting/grouping artists using the ALBUMARTISTSORT tag (with a fallback normalization), propagating the new sort metadata from the Rust backend through generated typings into the Artists view UI.
Changes:
- Introduce
album_artist_sortonTrackand persist it via DB migration + insert/update paths. - Change artist listing API to return
{ label, sort_as }and update the Artists route + SideNav grouping to use the sort key for sectioning. - Add a Rust unit test for the normalization fallback and update mocks/generated typings accordingly.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/translations/zh-TW.po | Update source line reference for “Rename”. |
| src/translations/zh-CN.po | Update source line reference for “Rename”. |
| src/translations/ru.po | Update source line reference for “Rename”. |
| src/translations/ja.po | Update source line reference for “Rename”. |
| src/translations/fr.po | Update source line reference for “Rename”. |
| src/translations/es.po | Update source line reference for “Rename”. |
| src/translations/en.po | Update source line reference for “Rename”. |
| src/routes/artists.tsx | Consume new Artist {label, sort_as} shape and pass grouping label to SideNavLink. |
| src/lib/utils-library.ts | Switch artist sort key to album_artist_sort; adjust title sort key. |
| src/lib/bridge-database.ts | Update getAllArtists() typing to return Artist[]. |
| src/lib/mocks/bridge-database.ts | Update mock tracks for new album_artist_sort field; adjust getAllArtists() signature. |
| src/generated/typings.ts | Add generated Artist type and add album_artist_sort to Track. |
| src/components/SideNavLink.tsx | Add optional groupingLabel prop used for sidebar grouping. |
| src/components/SideNav.tsx | Group sidebar items by groupingLabel when provided. |
| src-tauri/src/plugins/db.rs | Update Tauri command get_artists to return Vec<Artist>. |
| src-tauri/src/migrations/04_add_album_artist_sort_columns.sql | Add album_artist_sort column and backfill from album_artist. |
| src-tauri/src/libs/track.rs | Add album_artist_sort to Track; read ALBUMARTISTSORT tag with fallback normalization; introduce Artist struct export. |
| src-tauri/src/libs/tests/track_test.rs | Add tests for normalize_album_artist_sort. |
| src-tauri/src/libs/tests/database_tests.rs | Update test tracks for new album_artist_sort field. |
| src-tauri/src/libs/mod.rs | Register new track normalization test module. |
| src-tauri/src/libs/database.rs | Persist album_artist_sort; change get_artists() to use album_artist_sort for ordering and return Artist. |
| .vscode/extensions.json | Add recommended VS Code extension. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ff998e5 to
8dc376f
Compare
7ea2fef to
3c764b7
Compare
8dc376f to
9cf16d0
Compare
47fc092 to
d7dc078
Compare
017fec9 to
4d87394
Compare
There was a problem hiding this comment.
Pull request overview
Adds backend + frontend support for “Album Artist Sort” to improve artist list ordering/grouping (issue #941), by persisting an album_artist_sort value per track and using it for artist list sorting and side-nav grouping.
Changes:
- Add
album_artist_sortto track metadata (Rust Track struct, SQLite schema migration, generated TS typings). - Update the artists API to return
{label, sort_as}objects and usesort_asfor UI grouping while keepinglabelfor display/routing. - Add tests covering artist sorting behavior and normalization fallback.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src-tauri/src/migrations/04_add_album_artist_sort_columns.sql | Adds album_artist_sort column and backfills existing rows. |
| src-tauri/src/libs/track.rs | Reads ALBUMARTISTSORT, adds normalization fallback, extends Track struct, introduces Artist struct. |
| src-tauri/src/libs/database.rs | Persists album_artist_sort; get_artists() now returns Artist {label, sort_as} and orders by sort key. |
| src-tauri/src/plugins/db.rs | Updates Tauri command signature for get_artists to return Vec<Artist>. |
| src/generated/typings.ts | Regenerates typings to include Artist and Track.album_artist_sort. |
| src/lib/bridge-database.ts | Updates getAllArtists() to return Artist[]. |
| src/routes/artists.tsx | Consumes Artist[], routes by label, groups by sort_as. |
| src/components/SideNav.tsx | Allows grouping by groupingLabel (sort key) instead of display label. |
| src/components/SideNavLink.tsx | Adds optional groupingLabel prop to support SideNav grouping. |
| src/lib/utils-library.ts | Uses album_artist_sort for “Artist” track sorting. |
| src-tauri/src/libs/tests/database_tests.rs | Adds integration test for artist sorting/excluding compilations. |
| src-tauri/src/libs/tests/track_test.rs | Adds unit tests for normalize_album_artist_sort(). |
| src-tauri/src/libs/mod.rs | Registers new Rust test module. |
| src/lib/mocks/bridge-database.ts | Updates mocked tracks + bridge type signature for new fields/types. |
| src/translations/*.po | Updates source line references due to SideNavLink prop change. |
| .vscode/extensions.json | Adds a VS Code recommendation entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4d87394 to
fefac23
Compare
585379b to
5b6ff3b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // For performance reasons, otherwise _.orderBy will perform weird checks | ||
| // that are far more resource/time impactful | ||
| const ARTIST = (t: Track): string => | ||
| stripAccents(t.artists.toString().toLowerCase()); | ||
| stripAccents(t.album_artist_sort.toString().toLowerCase()); | ||
| const GENRE = (t: Track): string => |
There was a problem hiding this comment.
SortBy.Artist now uses Track.album_artist_sort as the primary key. However, the track edit flow (LibraryAPI.updateTrackMetadata) only updates album_artist (via TrackMutation) and then persists the full Track back to the DB, which can leave album_artist_sort stale after a user renames an album artist. Consider recomputing album_artist_sort when updating tracks (either in the frontend when album_artist changes, or in the backend update_track), so sorting/grouping stays consistent after edits.
5b6ff3b to
fc2f2c3
Compare
Fix #941