fix: prevent 9-second downloads caused by short iTunes duration match
When iTunes enrichment returns a jingle/preview as the first result (e.g. trackTimeMillis=9000), the yt-dlp duration filter becomes impossible (duration > 30 & duration < 24), all filtered steps fail, and the final unfiltered fallback downloads whatever YouTube returns first — often a short clip. Fix 1: spotify.js — only copy iTunes trackTimeMillis to durationMs when it is > 30 seconds (genuine song, not a jingle or preview). Fix 2: ytdlp.js — only enter the duration-filtered search branch when durationMs > 30 000ms, so a corrupted short value silently falls back to the unfiltered search path which still finds the correct full song. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3db71c24a4
commit
2df5a54985
2 files changed
+4
-2
No files matched your search
+3
-1
@@ -305,7 +305,9 @@ async function _loadSpotifyTrackArtwork(tracks, listEl) {
|
||||
if (match.collectionName) t.collectionName = match.collectionName;
|
||||
if (match.releaseDate) t.releaseDate = match.releaseDate;
|
||||
if (match.trackNumber) t.trackNumber = match.trackNumber;
|
||||
if (match.trackTimeMillis) t.durationMs = match.trackTimeMillis;
|
||||
// Only use iTunes duration if it looks like a full song (> 30s) — jingles/previews
|
||||
// returning a small trackTimeMillis would corrupt the yt-dlp duration filter.
|
||||
if (match.trackTimeMillis > 30000) t.durationMs = match.trackTimeMillis;
|
||||
}
|
||||
if (window._spotifyResolved?.tracks?.[idx]) Object.assign(window._spotifyResolved.tracks[idx], t);
|
||||
const url = match.artworkUrl100 || match.artworkUrl60 || '';
|
||||
|
||||
Reference in new issue
Block a user