11 Commits

Author SHA1 Message Date
Kendall Garner
8d594671c4
fix(subsonic): Sort songs by presence of lyrics for getLyrics (#4237)
* fix(subsonic): Sort songs by presence of lyrics for `getLyrics`

The current implementation of `getLyrics` fetches any songs matching the artist and title.
However, this misses a case where there may be multiple matches for the same artist/song, and one has lyrics while the other doesn't.
Resolve this by adding a custom SQL dynamic column that checks for the presence of lyrics.

* add options to selectMediaFile, update test

* more robust testing of GetAllByLyrics

* fix(subsonic): refactor GetAllByLyrics to GetAll with lyrics sorting

Signed-off-by: Deluan <deluan@navidrome.org>

* use has_lyrics, and properly support multiple sort parts

* better handle complicated internal sorts

* just use a simpler filter

* add note to setSortMappings

* remove custom sort mapping, improve test with different updatedat

* refactor tests and mock

Signed-off-by: Deluan <deluan@navidrome.org>

* default order when not specified is `asc`

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
2025-06-16 12:04:41 -04:00
Deluan
ecf934feab fix(subsonic): random albums not reshuffling.
See: https://github.com/navidrome/navidrome/issues/3277#issuecomment-2364269787
2024-09-20 16:59:46 -04:00
Deluan
3107170afd Improve SQL sanitization 2024-09-14 18:53:34 -04:00
Deluan
e65eb225c8 Small refactoring
- Remove duplication
- Remove warning about builtin keyword `new`
2024-09-13 20:18:00 -04:00
Deluan
62cc8a2d4b Fix ambiguous column when sorting media_files by created_at.
Fix #3006
2024-05-08 08:24:26 -04:00
Deluan
fa7cc40d23 Add tests for toSQL 2024-01-27 12:16:38 -05:00
Deluan
7d0656f44a Order albums by full original date. Fixes #1452 2023-05-22 23:50:16 -04:00
Deluan
31882abf6f Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
Deluan
1940267a18 Handle functions with params in sort order.
Related to #1023
2021-05-28 17:35:32 -04:00
Deluan
6ee45a9ccc Move project to Navidrome GitHub organization 2021-02-06 21:46:35 -05:00
Deluan
db5b9246dd Handle more sort/order cases 2020-12-23 11:37:38 -05:00