feat(backend): Mittelweg cascade — never download wrong song on no duration match

When a track's duration is known but nothing matches the duration window, the
cascade no longer falls back to blind title-only/no-filter grabs (which pulled
same-titled videos by other uploaders, e.g. a "recognize" fan clip). Instead it
relaxes only the duration constraint while still REQUIRING the artist channel +
title. If nothing matches, the download produces no file and the job now fails
cleanly with "Nicht eindeutig gefunden — bitte Direktlink im Importer nutzen"
(previously it falsely reported success with no file).

Single, album and playlist paths all surface the not-found state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-06-19 18:13:59 +02:00
1 parent cf6e75b312
commit a870f50c87
3 files changed
+23 -29

No files matched your search

+3 -1
View File
@@ -33,7 +33,9 @@ async function downloadAlbumTracks({ jobId, artist, albumTitle, tracks, artworkU
outputDir: CONFIG.musicPath,
durationMs: track.trackTimeMillis || undefined,
});
if (result?.skipped) skipped++; else done++;
if (result?.skipped) skipped++;
else if (result?.notFound) log(jobId, `⚠️ Nicht eindeutig gefunden: "${track.trackName || track.title}" — Direktlink nutzen`);
else done++;
updateJob(jobId, { progress: Math.round(((done + skipped) / total) * 90) });
} catch (e) {
log(jobId, `⚠️ Fehler bei "${track.trackName || track.title}": ${e.message}`);