Compare commits

..

22 Commits

Author SHA1 Message Date
gronod b40307a421 merge branch 'develop' into 'main' - Release v1.7.36
CI / Swagger Validation & Coverage (push) Successful in 1m48s
Create Release / release (push) Successful in 22s
CI / Security audit (push) Successful in 4m18s
Build and Push Docker Image / build (push) Successful in 1m57s
CI / Tests & coverage (push) Successful in 8m50s
2026-05-29 13:38:02 +01:00
gronod 97e2f256e6 merge branch 'develop' into 'main' - Release v1.7.35
CI / Swagger Validation & Coverage (push) Successful in 1m55s
Create Release / release (push) Successful in 27s
CI / Security audit (push) Successful in 4m0s
Build and Push Docker Image / build (push) Successful in 1m33s
CI / Tests & coverage (push) Failing after 5m4s
2026-05-29 13:24:33 +01:00
gronod d29b6e9223 merge branch 'develop' into 'main' - Release v1.7.34
Create Release / release (push) Successful in 38s
Build and Push Docker Image / build (push) Successful in 2m38s
2026-05-28 18:15:33 +01:00
gronod 7f7a91f056 merge branch 'develop' into 'main' - Release v1.7.33
CI / Tests & coverage (push) Successful in 2m53s
Create Release / release (push) Successful in 17s
CI / Security audit (push) Successful in 3m8s
Build and Push Docker Image / build (push) Successful in 1m11s
CI / Swagger Validation & Coverage (push) Successful in 2m23s
2026-05-28 17:42:54 +01:00
gronod 879aee8eea merge branch 'develop' into 'main' - Release v1.7.32 (include markdownlint fix)
Create Release / release (push) Successful in 30s
Build and Push Docker Image / build (push) Successful in 1m24s
CI / Security audit (push) Successful in 2m1s
CI / Swagger Validation & Coverage (push) Successful in 2m16s
CI / Tests & coverage (push) Successful in 2m37s
2026-05-28 16:28:23 +01:00
gronod f8f693e32a merge branch 'develop' into 'main' - Release v1.7.32
Create Release / release (push) Successful in 24s
CI / Security audit (push) Successful in 2m48s
Build and Push Docker Image / build (push) Successful in 2m14s
CI / Swagger Validation & Coverage (push) Successful in 2m54s
CI / Tests & coverage (push) Has been cancelled
2026-05-28 16:25:07 +01:00
gronod c18f5bd26e merge branch 'develop' into 'main' - Release v1.7.31
CI / Tests & coverage (push) Successful in 2m53s
Create Release / release (push) Successful in 29s
Build and Push Docker Image / build (push) Successful in 49s
CI / Security audit (push) Successful in 3m18s
CI / Swagger Validation & Coverage (push) Successful in 1m40s
2026-05-28 08:12:26 +01:00
gronod e726fbe33f merge branch 'develop' into 'main' - Release v1.7.30
Create Release / release (push) Successful in 42s
CI / Security audit (push) Successful in 1m36s
CI / Swagger Validation & Coverage (push) Successful in 3m20s
CI / Tests & coverage (push) Successful in 3m53s
2026-05-28 08:03:41 +01:00
gronod 4107bdf611 merge branch 'develop' into 'main' - Fix CHANGELOG formatting for Release v1.7.30
CI / Security audit (push) Successful in 1m18s
CI / Tests & coverage (push) Successful in 1m55s
CI / Swagger Validation & Coverage (push) Successful in 1m24s
Create Release / release (push) Successful in 14s
2026-05-28 07:02:57 +01:00
gronod 52806d00dc merge branch 'develop' into 'main' - Release v1.7.30
CI / Tests & coverage (push) Successful in 2m9s
Create Release / release (push) Successful in 33s
Build and Push Docker Image / build (push) Successful in 1m3s
CI / Security audit (push) Successful in 2m52s
CI / Swagger Validation & Coverage (push) Successful in 2m4s
2026-05-28 01:39:13 +01:00
gronod dcb77dd27f merge branch 'develop' into 'main' - Release v1.7.29
CI / Security audit (push) Successful in 2m47s
Create Release / release (push) Successful in 40s
CI / Swagger Validation & Coverage (push) Successful in 1m55s
Build and Push Docker Image / build (push) Successful in 1m19s
CI / Tests & coverage (push) Successful in 3m32s
2026-05-27 23:51:12 +01:00
gronod 6c3ffb9b77 merge branch 'develop' into 'main' - Release v1.7.28
Create Release / release (push) Successful in 22s
CI / Swagger Validation & Coverage (push) Successful in 1m52s
Build and Push Docker Image / build (push) Successful in 49s
CI / Security audit (push) Successful in 3m1s
CI / Tests & coverage (push) Successful in 3m38s
2026-05-27 23:26:11 +01:00
gronod 7226404221 merge branch 'develop' into 'main' - Release v1.7.27
Create Release / release (push) Successful in 37s
CI / Swagger Validation & Coverage (push) Successful in 2m5s
CI / Security audit (push) Successful in 2m59s
Build and Push Docker Image / build (push) Successful in 1m39s
CI / Tests & coverage (push) Successful in 3m48s
2026-05-27 23:11:37 +01:00
gronod 0eaa54cf4a merge branch 'develop' into 'main' - Release v1.7.26
Create Release / release (push) Successful in 8s
CI / Security audit (push) Successful in 3m0s
CI / Swagger Validation & Coverage (push) Successful in 1m57s
Build and Push Docker Image / build (push) Successful in 1m26s
CI / Tests & coverage (push) Successful in 3m37s
2026-05-27 22:50:31 +01:00
gronod fd0dc7528d merge branch 'develop' into 'main' - Release v1.7.25
Create Release / release (push) Successful in 23s
CI / Security audit (push) Successful in 1m49s
Build and Push Docker Image / build (push) Successful in 1m50s
CI / Swagger Validation & Coverage (push) Successful in 2m18s
CI / Tests & coverage (push) Successful in 2m30s
2026-05-27 21:43:45 +01:00
gronod c4e584cc3b merge branch 'develop' into 'main' - Release v1.7.24
Create Release / release (push) Successful in 29s
Build and Push Docker Image / build (push) Successful in 57s
CI / Security audit (push) Successful in 3m7s
CI / Swagger Validation & Coverage (push) Successful in 1m49s
CI / Tests & coverage (push) Successful in 3m43s
2026-05-27 19:35:19 +01:00
gronod 610632c4f0 merge branch 'develop' into 'main' - Release v1.7.23
Build and Push Docker Image / build (push) Successful in 1m4s
Create Release / release (push) Successful in 53s
CI / Security audit (push) Successful in 1m42s
CI / Swagger Validation & Coverage (push) Successful in 1m42s
CI / Tests & coverage (push) Successful in 2m21s
2026-05-27 19:16:23 +01:00
gronod 1535a5725a merge branch 'develop' into 'main' - Release v1.7.22
Create Release / release (push) Successful in 29s
Build and Push Docker Image / build (push) Successful in 2m33s
CI / Swagger Validation & Coverage (push) Successful in 1m57s
CI / Security audit (push) Successful in 2m26s
CI / Tests & coverage (push) Successful in 2m55s
2026-05-27 17:44:51 +01:00
gronod 8fb00843ef merge branch 'develop' into 'main' - Release v1.7.21
CI / Security audit (push) Successful in 2m50s
CI / Swagger Validation & Coverage (push) Successful in 3m23s
CI / Tests & coverage (push) Successful in 3m30s
Build and Push Docker Image / build (push) Successful in 46s
Create Release / release (push) Successful in 11s
2026-05-26 15:20:40 +01:00
gronod 6f6aa5b967 merge branch 'develop' into 'main' - Release v1.7.20
Build and Push Docker Image / build (push) Successful in 1m13s
Create Release / release (push) Successful in 1m3s
CI / Security audit (push) Successful in 2m36s
CI / Swagger Validation & Coverage (push) Successful in 3m7s
CI / Tests & coverage (push) Successful in 3m15s
2026-05-26 13:43:33 +01:00
gronod fb68bddedb merge branch 'develop' into 'main' - Update Release v1.7.19 to ignore scratch directory
Build and Push Docker Image / build (push) Successful in 1m8s
Create Release / release (push) Successful in 36s
CI / Tests & coverage (push) Successful in 1m55s
CI / Security audit (push) Successful in 2m12s
CI / Swagger Validation & Coverage (push) Successful in 1m50s
2026-05-25 08:33:16 +01:00
gronod 7d7304637c merge branch 'develop' into 'main' - Release v1.7.19
Create Release / release (push) Successful in 33s
Build and Push Docker Image / build (push) Successful in 2m19s
CI / Security audit (push) Successful in 2m14s
CI / Tests & coverage (push) Successful in 2m21s
CI / Swagger Validation & Coverage (push) Successful in 2m24s
2026-05-25 08:28:28 +01:00
7 changed files with 94 additions and 142 deletions
+1 -15
View File
@@ -2,21 +2,7 @@
All notable changes to this project will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.7.38] - 2026-05-29
### Fixed
- **SABnzbd History Legacy Slot Name Compatibility (Issue #74)** — Hardened SABnzbd active-download and history slot title matching in `DownloadMatcher.js` to support all slot name property variations (`filename`, `nzbname`, `name`, `nzb_name`). This ensures history matching succeeds against cached/legacy data schemas where the name is stored solely under the `filename` property, preventing completed downloads awaiting import from incorrectly displaying as `"Unknown"` client cards. Added unit tests for legacy `filename` slot matching compatibility.
## [1.7.37] - 2026-05-29
### Fixed
- **SABnzbd History Matching Symmetry (Issue #74)** — Consolidated SABnzbd active-download matching algorithms in `DownloadMatcher.js` by introducing a unified, type-safe internal helper `findSabMatch(sabDownloadId, nzbName, context, caller)`. Refactored `matchSabSlots` and `matchSabHistory` to route entirely through `findSabMatch`. This resolves a bug where completed SABnzbd downloads awaiting manual import in Sonarr or Radarr queues were incorrectly flagged as "unknown" client/"Orphaned (unconfigured client)". Added detailed unit tests to safeguard this behavior.
## [1.7.36] - 2026-05-29
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).## [1.7.36] - 2026-05-29
### Fixed
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "sofarr",
"version": "1.7.38",
"version": "1.7.36",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sofarr",
"version": "1.7.38",
"version": "1.7.36",
"license": "MIT",
"dependencies": {
"axios": "^1.6.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sofarr",
"version": "1.7.38",
"version": "1.7.36",
"description": "A personal media download dashboard that shows your downloads 'so far' while you relax on the sofa waiting for your *arr services to finish",
"main": "server/index.js",
"scripts": {
+1 -1
View File
@@ -133,7 +133,7 @@ function createApp({ skipRateLimits = false } = {}) {
* version:
* type: string
* description: sofarr version
* example: "1.7.38"
* example: "1.7.36"
* x-code-samples:
* - lang: curl
* label: cURL
+1 -1
View File
@@ -22,7 +22,7 @@ info:
## SSE Streaming
Real-time updates are available via Server-Sent Events at GET /api/dashboard/stream.
version: 1.7.38
version: 1.7.36
contact:
name: sofarr
license:
+88 -67
View File
@@ -53,65 +53,6 @@ function titleMatches(clientName, arrTitle, { isFallback = true, caller = 'Downl
return matched;
}
/**
* Internal helper: Finds the best matching Sonarr or Radarr record for a SABnzbd slot.
* Performs robust case-insensitive downloadId matching (queue → history),
* then bidirectional title fallback (queue → history).
* This eliminates all duplication and asymmetry between matchSabSlots and matchSabHistory.
*
* @param {string|null} sabDownloadId
* @param {string} nzbName
* @param {Object} context
* @param {string} caller - e.g. 'matchSabHistory' or 'matchSabSlots'
* @returns {{ sonarrMatch: Object|null, radarrMatch: Object|null }}
*/
function findSabMatch(sabDownloadId, nzbName, context, caller = 'DownloadMatcher') {
const {
sonarrQueueRecords = [],
sonarrHistoryRecords = [],
radarrQueueRecords = [],
radarrHistoryRecords = []
} = context;
const findBest = (queueRecords, historyRecords) => {
// 1. Robust ID match (queue first)
let match = sabDownloadId
? queueRecords.find(r => {
const dl = r && r.downloadId;
return dl && String(dl).toLowerCase() === String(sabDownloadId).toLowerCase();
})
: null;
if (!match && sabDownloadId) {
match = historyRecords.find(r => {
const dl = r && r.downloadId;
return dl && String(dl).toLowerCase() === String(sabDownloadId).toLowerCase();
});
}
// 2. Title fallback (queue first, then history)
if (!match && nzbName) {
match = queueRecords.find(r => {
const rTitle = r && (r.title || r.sourceTitle);
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller });
});
}
if (!match && nzbName) {
match = historyRecords.find(r => {
const rTitle = r && (r.title || r.sourceTitle);
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller });
});
}
return match || null;
};
return {
sonarrMatch: findBest(sonarrQueueRecords, sonarrHistoryRecords),
radarrMatch: findBest(radarrQueueRecords, radarrHistoryRecords)
};
}
/**
* All callers (matchers + orphan path) must supply client, instanceId, and instanceName via options.
* Defaults exist only as a last-resort safety net.
@@ -290,14 +231,52 @@ async function matchSabSlots(slots, context) {
const matched = [];
for (const slot of slots) {
const nzbName = slot.filename || slot.nzbname || slot.name || slot.nzb_name;
const nzbName = slot.filename || slot.nzbname;
if (!nzbName) continue;
const slotState = getSlotStatusAndSpeed(slot, queueStatus, queueSpeed, queueKbpersec);
const nzbNameLower = nzbName.toLowerCase();
// Try to match by downloadId first (most reliable)
const sabDownloadId = slot.nzo_id || slot.id;
const { sonarrMatch, radarrMatch } = findSabMatch(sabDownloadId, nzbName, context, 'matchSabSlots');
let sonarrMatch = sabDownloadId ? sonarrQueueRecords.find(r => r.downloadId === sabDownloadId) : null;
let radarrMatch = sabDownloadId ? radarrQueueRecords.find(r => r.downloadId === sabDownloadId) : null;
// Also check HISTORY by downloadId
if (!sonarrMatch && sabDownloadId) {
sonarrMatch = sonarrHistoryRecords.find(r => r.downloadId === sabDownloadId);
}
if (!radarrMatch && sabDownloadId) {
radarrMatch = radarrHistoryRecords.find(r => r.downloadId === sabDownloadId);
}
// Fallback: Check by title matching
if (!sonarrMatch) {
sonarrMatch = sonarrQueueRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabSlots' });
});
}
if (!radarrMatch) {
radarrMatch = radarrQueueRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabSlots' });
});
}
// Also check HISTORY (completed downloads) if no queue match
if (!sonarrMatch) {
sonarrMatch = sonarrHistoryRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabSlots' });
});
}
if (!radarrMatch) {
radarrMatch = radarrHistoryRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabSlots' });
});
}
// Progress calculation
const mbValue = slot.mb !== undefined && slot.mb !== null ? parseFloat(slot.mb) : 0;
@@ -343,20 +322,63 @@ async function matchSabSlots(slots, context) {
return matched;
}
/**
* Matches SABnzbd history slots to Sonarr/Radarr activity using title matching.
* @param {Array} slots - SABnzbd history slots
* @param {Object} context - Matching context with records, maps, and user info
* @returns {Array} Array of matched download objects
*/
async function matchSabHistory(slots, context) {
const {
sonarrQueueRecords,
sonarrHistoryRecords,
radarrQueueRecords,
radarrHistoryRecords
} = context;
const matched = [];
for (const slot of slots) {
const nzbName = slot.filename || slot.nzbname || slot.name || slot.nzb_name;
const nzbName = slot.name || slot.nzb_name || slot.nzbname;
if (!nzbName) continue;
const nzbNameLower = nzbName.toLowerCase();
// Try to match by downloadId (nzo_id or slot ID) first (most reliable)
const sabDownloadId = slot.nzo_id || slot.id;
const { sonarrMatch, radarrMatch } = findSabMatch(sabDownloadId, nzbName, context, 'matchSabHistory');
const matchesSabId = (r) => {
const dl = r && r.downloadId;
if (!dl || !sabDownloadId) return false;
return String(dl).toLowerCase() === String(sabDownloadId).toLowerCase();
};
let sonarrMatch = sabDownloadId ? sonarrHistoryRecords.find(matchesSabId) : null;
let radarrMatch = sabDownloadId ? radarrHistoryRecords.find(matchesSabId) : null;
// Dual-lookup: also try against active queue records (history slot may still be in *arr queue)
if (!sonarrMatch && sabDownloadId) {
sonarrMatch = sonarrQueueRecords.find(matchesSabId);
}
if (!radarrMatch && sabDownloadId) {
radarrMatch = radarrQueueRecords.find(matchesSabId);
}
// Fallback: Check by title matching
if (!sonarrMatch) {
sonarrMatch = sonarrHistoryRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabHistory' });
});
}
if (!radarrMatch) {
radarrMatch = radarrHistoryRecords.find(r => {
const rTitle = r.title || r.sourceTitle;
return rTitle && titleMatches(nzbName, rTitle, { isFallback: true, caller: 'matchSabHistory' });
});
}
const commonOptions = {
title: nzbName,
status: slot.status || 'Completed',
progress: 100,
progress: 100, // History items are completed
mb: slot.mb,
size: Math.round((slot.mb || 0) * 1024 * 1024),
completedAt: slot.completed_time,
@@ -370,7 +392,7 @@ async function matchSabHistory(slots, context) {
const dlObj = buildArrDownload(sonarrMatch, context, {
...commonOptions,
arrType: 'sonarr',
episodes: DownloadAssembler.gatherEpisodes(nzbName.toLowerCase(), context.sonarrHistoryRecords || [])
episodes: DownloadAssembler.gatherEpisodes(nzbNameLower, sonarrHistoryRecords)
});
if (dlObj) matched.push(dlObj);
}
@@ -383,7 +405,6 @@ async function matchSabHistory(slots, context) {
if (dlObj) matched.push(dlObj);
}
}
return matched;
}
@@ -226,61 +226,6 @@ describe('DownloadMatcher', () => {
expect(result).toHaveLength(1);
expect(result[0].arrQueueId).toBe(101);
});
it('falls back to title matching against Sonarr queue records when downloadId is absent/unmatched', async () => {
const testContext = {
...context,
sonarrHistoryRecords: [],
sonarrQueueRecords: [
{ id: 201, seriesId: 1, title: 'My.Cool.Show.S01E01.720p-Group' }
],
seriesMap: new Map([[1, { id: 1, title: 'My Cool Show', tags: [1] }]])
};
const slots = [{ id: null, name: 'My_Cool_Show_S01E01_720p-Group.nzb', status: 'Completed', mb: 1000 }];
const result = await DownloadMatcher.matchSabHistory(slots, testContext);
expect(result).toHaveLength(1);
expect(result[0].arrQueueId).toBe(201);
expect(result[0].arrType).toBe('sonarr');
});
it('falls back to title matching against Radarr queue records when downloadId is absent/unmatched', async () => {
const testContext = {
...context,
radarrHistoryRecords: [],
radarrQueueRecords: [
{ id: 301, movieId: 2, title: 'Awesome Movie 2026 1080p' }
],
moviesMap: new Map([[2, { id: 2, title: 'Awesome Movie', tags: [1] }]]),
radarrTagMap: new Map([[1, 'alice']])
};
const slots = [{ id: null, name: 'Awesome.Movie.2026.1080p.nzb', status: 'Completed', mb: 1000 }];
const result = await DownloadMatcher.matchSabHistory(slots, testContext);
expect(result).toHaveLength(1);
expect(result[0].arrQueueId).toBe(301);
expect(result[0].arrType).toBe('radarr');
});
it('matches when history slots only have the filename field (cached legacy format)', async () => {
const testContext = {
...context,
sonarrHistoryRecords: [],
sonarrQueueRecords: [
{ id: 201, seriesId: 1, title: 'My.Cool.Show.S01E01.720p-Group' }
],
seriesMap: new Map([[1, { id: 1, title: 'My Cool Show', tags: [1] }]])
};
const slots = [{ id: null, filename: 'My_Cool_Show_S01E01_720p-Group.nzb', status: 'Completed', mb: 1000 }];
const result = await DownloadMatcher.matchSabHistory(slots, testContext);
expect(result).toHaveLength(1);
expect(result[0].arrQueueId).toBe(201);
expect(result[0].arrType).toBe('sonarr');
});
});
describe('titleMatches helper', () => {