fix: SABnzbd queue.speed format for Homepage rate widget - #227
Open
scottcowan wants to merge 2 commits into
Open
fix: SABnzbd queue.speed format for Homepage rate widget#227scottcowan wants to merge 2 commits into
scottcowan wants to merge 2 commits into
Conversation
Homepage parses speed as '<number> <K|M|G>' (e.g. '1.3 M'). formatBytes()+'/s' produced '1.2 MB/s', so fromUnits() returned 0 and rate always showed zero. Use formatSabnzbdSpeedKbps() aligned with SABnzbd API examples. Co-authored-by: Cursor <cursoragent@cursor.com>
StormPooper
reviewed
May 5, 2026
…parser Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
The trailing space is intentional — it matches real SABnzbd's API output ( I've added a test (fd62096) that documents this contract explicitly: |
StormPooper
approved these changes
May 5, 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.
Summary
Format
queue.speedlike real SABnzbd ("1.3 M","0 ", …) instead offormatBytes(...) + "/s"("1.2 MB/s"), so clients that parse the short form (notably Homepage’s SABnzbd widget) show a non-zero rate when downloading.How we know this is correct
SABnzbd contract — Official API docs show JSON such as
"speed": "1.3 M"next to"kbpersec": "1296.02". That defines the intended string shape forqueue.speed.https://sabnzbd.org/wiki/configuration/5.0/api
Homepage parser —
fromUnits()splitsqueue.speedon a space and treats the second token as a single letter inB|K|M|G|T|P. Any other token (e.g.MB/s) makesindexOffail and the rate becomes 0.https://github.com/gethomepage/homepage/blob/dev/src/widgets/sabnzbd/component.jsx
Homepage tests (behaviour spec) — Their widget test passes
speed: "1.0 M"and asserts the derived rate; that codifies the same contract as SABnzbd’s examples.https://github.com/gethomepage/homepage/blob/dev/src/widgets/sabnzbd/component.test.jsx
Before / after — iPlayarr used
formatBytes(totalSpeedKbs * 1024) + "/s"→ strings like"500.00 KB/s", which do not match that parser.formatSabnzbdSpeedKbps()emits the short tier form sofromUnitsmatches SABnzbd + Homepage.Tests — Unit tests for
formatSabnzbdSpeedKbps(including1296.02→"1.3 M") and updatedQueueEndpointexpectations; fullnpm test(373 tests) passes.Related