Deterministic pagination in random albums sort (#1841)

* Deterministic pagination in random albums sort

* Reseed on first random page

* Add unit tests

* Use rand in Subsonic API

* Use different seeds per user on SEEDEDRAND() SQLite3 function

* Small refactor

* Fix id mismatch

* Add seeded random to media_file (subsonic endpoint `getRandomSongs`)

* Refactor

* Remove unneeded import

---------

Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Guilherme Souza
2024-05-18 15:10:53 -03:00
committed by GitHub
parent a9feeac793
commit 98218d045e
7 changed files with 110 additions and 8 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ func AlbumsByFrequent() Options {
}
func AlbumsByRandom() Options {
return Options{Sort: "random()"}
return Options{Sort: "random"}
}
func AlbumsByName() Options {
@@ -100,7 +100,7 @@ func SongsByAlbum(albumId string) Options {
func SongsByRandom(genre string, fromYear, toYear int) Options {
options := Options{
Sort: "random()",
Sort: "random",
}
ff := squirrel.And{}
if genre != "" {