iOS 1.0.2: shuffle the whole library from Songs

Shuffle used only the pages loaded so far (the A and B songs). It now
asks Plex for 1000 random tracks from the whole library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-10-20 08:53:16 -07:00
1 parent 2ddfe051d8
commit a0726b07a1
4 files changed
+17 -4

No files matched your search

+5
View File
@@ -132,6 +132,11 @@ final class PlexClient: @unchecked Sendable {
return (c.metadata.map { $0.toTrack() }, c.totalSize ?? c.size)
}
/// Random tracks from the whole library, for shuffling it without loading every page.
func randomTracks(_ count: Int) async throws -> [Track] {
try await get("/library/sections/\(section)/all", [("type", 10), ("sort", "random")], start: 0, size: count).metadata.map { $0.toTrack() }
}
func album(_ key: String) async throws -> Album? {
try await get("/library/metadata/\(key)").metadata.first?.toAlbum()
}