Skip to content

fix: correct SABnzbd priority numeric mapping - #78

Closed
thedancingdeveloper wants to merge 2 commits into
mainfrom
fix/sab-priority-mapping
Closed

fix: correct SABnzbd priority numeric mapping#78
thedancingdeveloper wants to merge 2 commits into
mainfrom
fix/sab-priority-mapping

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Collaborator

Summary

Fixes #71: sab_priority_to_priority mapped SABnzbd's numeric priority codes off by one (0→Low, 1→Normal, 2→High, "-100"/"3"→Force), contradicting sab_priority_matches in the same file, which already used the correct table (Low=-1, Normal=0, High=1, Force=2) for queue filtering.

Verified against sabnzbd/sabnzbd@5.1.x sabnzbd/constants.py:120-127:

FORCE_PRIORITY = 2, HIGH_PRIORITY = 1, NORMAL_PRIORITY = 0, LOW_PRIORITY = -1, DEFAULT_PRIORITY = -100, REPAIR_PRIORITY = 3

Fix

sab_priority_to_priority now uses the same numeric table as sab_priority_matches. -100 (SABnzbd's "use category default") and 3 (Repair, which we have no separate concept for) map to Normal and Force respectively, matching how real SABnzbd displays/treats them.

Test plan

  • cargo test -p nzb-web — added sab_priority_to_priority_matches_upstream_numeric_codes and sab_priority_to_priority_agrees_with_sab_priority_matches (the latter guards against the two tables silently diverging again).
  • cargo clippy -p nzb-web --all-targets — clean.
  • Full nzb-web test suite passes.

🤖 Generated with Claude Code

sab_priority_to_priority mapped 0/1/2/-100/3 to Low/Normal/High/Force,
shifted by one from SABnzbd's real numeric codes (constants.py:
Low=-1, Normal=0, High=1, Force=2, Default=-100, Repair=3) and
contradicting sab_priority_matches, which already used the correct
table for queue filtering. Any client setting priority via
addfile/addurl/priority-change got the wrong priority applied.
# Conflicts:
#	crates/nzb-web/src/sabnzbd_compat.rs
@thedancingdeveloper

Copy link
Copy Markdown
Collaborator Author

Superseded — this change landed via #84, which stacked all of #71-#77's fixes together and was squash-merged to save on redundant CI runs. Closing without merging to avoid re-applying the same diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SABnzbd compat: priority numeric mapping is off-by-one (sab_priority_to_priority)

1 participant