fix: resolve blocklist & search failures on Sonarr season packs and multi-episode releases
Build and Push Docker Image / build (push) Successful in 1m31s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 2m42s
CI / Security audit (push) Successful in 3m26s
CI / Swagger Validation & Coverage (push) Successful in 3m43s
CI / Tests & coverage (push) Successful in 4m19s

This commit is contained in:
2026-05-24 10:42:54 +01:00
parent 3f8970ea99
commit 5488969387
6 changed files with 84 additions and 7 deletions
+10 -1
View File
@@ -276,7 +276,6 @@ components:
- arrQueueId
- arrType
- arrInstanceUrl
- arrContentId
- arrContentType
properties:
arrQueueId:
@@ -301,6 +300,16 @@ components:
type: integer
description: episodeId (Sonarr) or movieId (Radarr)
example: 456
arrContentIds:
type: array
items:
type: integer
description: Array of episodeIds for multi-episode packs (Sonarr)
example: [456, 457]
arrSeriesId:
type: integer
description: seriesId for fallback automatic series search (Sonarr)
example: 789
arrContentType:
type: string
enum: [episode, movie]
+12 -6
View File
@@ -676,10 +676,10 @@ router.get('/stream', requireAuth, async (req, res) => {
router.post('/blocklist-search', requireAuth, async (req, res) => {
try {
const user = req.user;
const { arrQueueId, arrType, arrInstanceUrl, arrInstanceKey, arrContentId, arrContentType } = req.body;
const { arrQueueId, arrType, arrInstanceUrl, arrInstanceKey, arrContentId, arrContentIds, arrSeriesId, arrContentType } = req.body;
if (!arrQueueId || !arrType || !arrInstanceUrl || !arrContentId || !arrContentType) {
console.error('[Blocklist] Missing required fields:', { arrQueueId, arrType, arrInstanceUrl, hasKey: !!arrInstanceKey, arrContentId, arrContentType });
if (!arrQueueId || !arrType || !arrInstanceUrl || !arrContentType) {
console.error('[Blocklist] Missing required fields:', { arrQueueId, arrType, arrInstanceUrl, hasKey: !!arrInstanceKey, arrContentType });
return res.status(400).json({ error: 'Missing required fields' });
}
if (arrType !== 'sonarr' && arrType !== 'radarr') {
@@ -724,8 +724,14 @@ router.post('/blocklist-search', requireAuth, async (req, res) => {
// Step 2: Trigger a new automatic search
let commandBody;
if (arrType === 'sonarr' && arrContentType === 'episode') {
commandBody = { name: 'EpisodeSearch', episodeIds: [arrContentId] };
} else if (arrType === 'radarr' && arrContentType === 'movie') {
if (arrContentId) {
commandBody = { name: 'EpisodeSearch', episodeIds: [arrContentId] };
} else if (Array.isArray(arrContentIds) && arrContentIds.length > 0) {
commandBody = { name: 'EpisodeSearch', episodeIds: arrContentIds.map(Number) };
} else if (arrSeriesId) {
commandBody = { name: 'SeriesSearch', seriesId: Number(arrSeriesId) };
}
} else if (arrType === 'radarr' && arrContentType === 'movie' && arrContentId) {
commandBody = { name: 'MoviesSearch', movieIds: [arrContentId] };
}
@@ -737,7 +743,7 @@ router.post('/blocklist-search', requireAuth, async (req, res) => {
const { pollAllServices } = require('../utils/poller');
pollAllServices().catch(() => {});
console.log(`[Dashboard] Blocklist+search: ${arrType} queueId=${arrQueueId} contentId=${arrContentId} by ${user.name}`);
console.log(`[Dashboard] Blocklist+search: ${arrType} queueId=${arrQueueId} contentId=${arrContentId || 'none'} by ${user.name}`);
res.json({ ok: true });
} catch (err) {
console.error('[Dashboard] blocklist-search error:', sanitizeError(err));
+4
View File
@@ -209,6 +209,8 @@ async function matchSabSlots(slots, context) {
dlObj.arrType = 'sonarr';
dlObj.arrInstanceUrl = sonarrMatch._instanceUrl || null;
dlObj.arrContentId = sonarrMatch.episodeId || null;
dlObj.arrContentIds = sonarrMatch.episodeIds || null;
dlObj.arrSeriesId = sonarrMatch.seriesId || null;
dlObj.arrContentType = 'episode';
if (isAdmin) {
dlObj.downloadPath = slot.storage || null;
@@ -451,6 +453,8 @@ async function matchTorrents(torrents, context) {
download.arrType = 'sonarr';
download.arrInstanceUrl = sonarrMatch._instanceUrl || null;
download.arrContentId = sonarrMatch.episodeId || null;
download.arrContentIds = sonarrMatch.episodeIds || null;
download.arrSeriesId = sonarrMatch.seriesId || null;
download.arrContentType = 'episode';
if (isAdmin) {
download.downloadPath = download.savePath || null;