debug(matching): Show queue vs history source and history titles
All checks were successful
Build and Push Docker Image / build (push) Successful in 39s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 53s
CI / Security audit (push) Successful in 1m10s
CI / Tests & coverage (push) Successful in 1m30s

When a match is found, logs whether it came from queue or history.
When no match, shows history counts and sample titles to verify
history is being checked properly.
This commit is contained in:
2026-05-19 22:10:34 +01:00
parent 235a866ec8
commit 77beef787f

View File

@@ -1054,17 +1054,20 @@ router.get('/stream', requireAuth, async (req, res) => {
// Debug first 5 items - show matches and non-matches // Debug first 5 items - show matches and non-matches
if (sabSlotsChecked <= 5) { if (sabSlotsChecked <= 5) {
if (sonarrMatch) { if (sonarrMatch) {
console.log(`[SSE] ✓ Sonarr match: SAB:"${nzbNameLower.substring(0, 50)}" → Sonarr:"${(sonarrMatch.title || sonarrMatch.sourceTitle || '').substring(0, 50)}"`); const source = sonarrQueue.data.records.includes(sonarrMatch) ? 'queue' : 'history';
console.log(`[SSE] ✓ Sonarr ${source} match: SAB:"${nzbNameLower.substring(0, 50)}" → Sonarr:"${(sonarrMatch.title || sonarrMatch.sourceTitle || '').substring(0, 50)}"`);
} else if (radarrMatch) { } else if (radarrMatch) {
console.log(`[SSE] ✓ Radarr match: SAB:"${nzbNameLower.substring(0, 50)}" → Radarr:"${(radarrMatch.title || radarrMatch.sourceTitle || '').substring(0, 50)}"`); const source = radarrQueue.data.records.includes(radarrMatch) ? 'queue' : 'history';
console.log(`[SSE] ✓ Radarr ${source} match: SAB:"${nzbNameLower.substring(0, 50)}" → Radarr:"${(radarrMatch.title || radarrMatch.sourceTitle || '').substring(0, 50)}"`);
} else { } else {
console.log(`[SSE] ✗ No match for SAB: "${nzbNameLower.substring(0, 60)}"`); console.log(`[SSE] ✗ No match for SAB: "${nzbNameLower.substring(0, 60)}"`);
// Show actual Sonarr titles to debug matching // Show counts
const sonarrTitles = sonarrQueue.data.records.slice(0, 5).map(r => { console.log(`[SSE] Queue: ${sonarrQueue.data.records.length}, History: ${sonarrHistory.data.records.length}`);
const fields = {title: r.title, sourceTitle: r.sourceTitle, seriesTitle: r.series?.title, episodeTitle: r.episode?.title}; // Show history titles if there are any
return JSON.stringify(fields).substring(0, 80); if (sonarrHistory.data.records.length > 0) {
}); const histTitles = sonarrHistory.data.records.slice(0, 3).map(r => (r.title || r.sourceTitle || 'NO_TITLE').substring(0, 40));
console.log(`[SSE] Sonarr fields: ${sonarrTitles.join(' | ')}`); console.log(`[SSE] History titles: ${histTitles.join(' | ')}`);
}
} }
} }
if (sonarrMatch && sonarrMatch.seriesId) { if (sonarrMatch && sonarrMatch.seriesId) {