Repository navigation
Add a ceiling to the slskd quality filters - #14
Merged
Merged
Conversation
The slskd filters were floors only, so nothing stopped a single recommended track arriving as a 138 MB WAV or a 100 MB 24/96 FLAC. In album mode that multiplies across a whole release. MAX_BITRATE sets the ceiling, defaulting to 0, which disables it -- an upgrade changes nothing until someone chooses a limit. The ceiling could not be written the way the floors are. Both existing checks skip a file when the peer reports no bitrate, which is common on Soulseek; a ceiling written that way round would let through exactly the files it exists to exclude. effectiveBitRate prefers the reported value where there is one, so files that describe themselves are judged exactly as before, and otherwise works the rate out from size over duration. A file with neither is treated as unknown and never rejected, since dropping everything undescribed would leave few candidates. Album mode exempts the recommended track from the quality floors, on the grounds that a mediocre playlist entry beats none. It is not exempt from the ceiling: that is a question about transfer volume rather than quality, and an oversized primary is the case being guarded against. In the wizard the free-text extensions field becomes format checkboxes and a range slider. The slider's stops are evenly spaced rather than linear, because real bitrates run to about 4600 and linear spacing would squeeze every lossy option into the first few percent of the track. Its top stop means no limit and writes 0. With no lossless format ticked the ceiling clamps to 320, since nothing above that is reachable and the two controls would otherwise contradict each other in silence. Extensions the checkboxes do not cover are kept in the saved value and shown, rather than being dropped by a control that cannot represent them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of two. Adds the quality range; the size preference (prefer smaller / larger) follows in a stacked PR.
Why
The slskd filters are floors only —
MIN_BITRATE,MIN_BIT_DEPTH— so nothing stops a single recommended track arriving as a 138 MB WAV. In album mode that multiplies across the whole release.The part that shaped the design
The ceiling couldn't be written the way the floors are. Both existing checks are guarded with
if file.BitRate > 0 &&because Soulseek peers frequently report nothing — and a ceiling that skips undescribed files would let through exactly what it exists to exclude.effectiveBitRateprefers the reported value where there is one, so files that describe themselves are judged exactly as before, and otherwise derives fromSize × 8 ÷ Length. Neither available means unknown, which is never rejected — dropping everything undescribed would leave very few candidates.MAX_BITRATEdefaults to0(disabled), so an upgrade changes nothing until someone sets a limit.One deliberate asymmetry
Album mode exempts the recommended track from the quality floors ("a mediocre playlist entry beats none"). It is not exempt from the ceiling — that's a question about transfer volume, not quality, and an oversized primary is precisely the case being guarded against. There's a test pinning each half.
UI
The wizard's free-text extensions field becomes format checkboxes plus a dual-handle bitrate slider.
0.opus,aiff) are preserved in the saved value and shown as "also accepting …" rather than being dropped.Testing
Mutation-checked, each fails without its fix:
the primary was kept despite being over the ceilingMIN_BITRATE/MAX_BITRATEinAllConfigKeys— fails withthe control would always read back as its defaultPlus:
effectiveBitRatein all three states, lossless classification, floor/ceiling boundaries, a zero ceiling rejecting nothing, unknown bitrate surviving, derivation catching a big unreported file, the primary keeping its floor exemption, and the wizard round-trip including a zero ceiling written rather than dropped.go build ./...,go vet ./src/...,go test ./src/...pass;npm run buildsucceeds.🤖 Generated with Claude Code