From 084cb0579e4ea6d4e251e9c8bd48613a777598f7 Mon Sep 17 00:00:00 2001 From: Gronod Date: Thu, 21 May 2026 01:55:03 +0100 Subject: [PATCH] Fix missing progress bar for SABnzbd downloads - Calculate progress from slot.mb and slot.mbleft instead of slot.percentage - Apply fix to both series and movie downloads in matchSabSlots - Add progress: 100 for history items in matchSabHistory (series and movie) - SABnzbd slot data doesn't have percentage field, so progress was undefined --- server/services/DownloadMatcher.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/server/services/DownloadMatcher.js b/server/services/DownloadMatcher.js index 0e51fd3..33840a0 100644 --- a/server/services/DownloadMatcher.js +++ b/server/services/DownloadMatcher.js @@ -157,12 +157,17 @@ function matchSabSlots(slots, context) { const allTags = TagMatcher.extractAllTags(series.tags, sonarrTagMap); const matchedUserTag = TagMatcher.extractUserTag(series.tags, sonarrTagMap, username); if (showAll ? allTags.length > 0 : !!matchedUserTag) { + // Calculate progress from SABnzbd slot data + const mbValue = slot.mb !== undefined && slot.mb !== null ? parseFloat(slot.mb) : 0; + const mbLeftValue = slot.mbleft !== undefined && slot.mbleft !== null ? parseFloat(slot.mbleft) : 0; + const progress = mbValue > 0 ? ((mbValue - mbLeftValue) / mbValue) * 100 : 0; + const dlObj = { type: 'series', title: nzbName, coverArt: DownloadAssembler.getCoverArt(series), status: slotState.status, - progress: slot.percentage, + progress: Math.round(progress), mb: slot.mb, mbmissing: slot.mbleft, size: Math.round(slot.mb * 1024 * 1024), @@ -202,12 +207,17 @@ function matchSabSlots(slots, context) { const allTags = TagMatcher.extractAllTags(movie.tags, radarrTagMap); const matchedUserTag = TagMatcher.extractUserTag(movie.tags, radarrTagMap, username); if (showAll ? allTags.length > 0 : !!matchedUserTag) { + // Calculate progress from SABnzbd slot data + const mbValue = slot.mb !== undefined && slot.mb !== null ? parseFloat(slot.mb) : 0; + const mbLeftValue = slot.mbleft !== undefined && slot.mbleft !== null ? parseFloat(slot.mbleft) : 0; + const progress = mbValue > 0 ? ((mbValue - mbLeftValue) / mbValue) * 100 : 0; + const dlObj = { type: 'movie', title: nzbName, coverArt: DownloadAssembler.getCoverArt(movie), status: slotState.status, - progress: slot.percentage, + progress: Math.round(progress), mb: slot.mb, mbmissing: slot.mbleft, size: Math.round(slot.mb * 1024 * 1024), @@ -285,6 +295,7 @@ function matchSabHistory(slots, context) { title: nzbName, coverArt: DownloadAssembler.getCoverArt(series), status: slot.status, + progress: 100, // History items are completed mb: slot.mb, size: Math.round((slot.mb || 0) * 1024 * 1024), completedAt: slot.completed_time, @@ -322,6 +333,7 @@ function matchSabHistory(slots, context) { title: nzbName, coverArt: DownloadAssembler.getCoverArt(movie), status: slot.status, + progress: 100, // History items are completed mb: slot.mb, size: Math.round((slot.mb || 0) * 1024 * 1024), completedAt: slot.completed_time,