fix(web): 'Unknown Artist' download from artist page + rename itunes*→deezer* identifiers

Fix (the reported bug):
- Deezer's /artist/{id}/albums omits the artist object, so discography album cards had an
  empty artist name → the download modal fell back to the literal "Unknown Artist", which
  poisoned the yt-dlp search ("Unknown Artist <album>") and its artist/channel filter, failing
  with "Nicht eindeutig gefunden".
- deezerLookupArtistAlbums now backfills the known artist name (we're on that artist's page).
- openDlModal now defaults album cards to an ALBUM download (was always Track), so a one-click
  download no longer grabs an album as a single track named after the album.

Rename (requested cleanup, dependency-checked so nothing breaks):
- All frontend itunes* identifiers → deezer* (functions, the ItunesItem-shape field keys
  itunesData/itunesArtistId/itunesFanCount/itunesId, the itunes-album-detail route + DOM ids,
  the badge-itunes CSS class). The backend reads none of these fields, so the boundary is safe.
- Verified: build passes; route/DOM-id/CSS producer↔consumer all consistent; only the factual
  "Apple's iTunes /search 403" comments keep the historical name. SW ns-v62.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-08-01 00:31:09 +02:00
1 parent bc87a04da5
commit 1e206e8df3
13 files changed
+118 -108

No files matched your search

+2 -1
View File
@@ -72,6 +72,7 @@ Big change: **the entire metadata/search stack moved from Apple's iTunes to Deez
- The autofill endpoint moved `/api/itunes/lookup` → **`/api/meta/lookup`**
- **Web + Android** — All user-visible "iTunes" / "Apple Music" labels are now "Deezer" (search badge, charts badge, preview bar, editor autofill button, artist "populär" heading)
- **Backend** — Removed the dead iTunes `/search` proxy and the Apple charts RSS proxy; the Deezer proxy (`/api/deezer/*`) now also serves charts and the editor lookup
- **Web** — Renamed the leftover `itunes*` frontend identifiers to `deezer*` (`itunesSearch` → `deezerSearch`, `itunesLookup*` → `deezerLookup*`, `itunesData`/`itunesArtistId` → `deezerData`/`deezerArtistId`, the `itunes-album-detail` route/DOM ids, the `badge-itunes` CSS class, …). Purely internal — no behaviour change; only the factual "Apple's iTunes /search 403" comments keep the old name
### Added
- **Web + Android** — **Same-name artist disambiguation**: Deezer's artist search isn't ranked by popularity, so a name collision (5 artists named "Joji") returned a niche one first — the artist page then loaded the wrong discography and owned songs didn't show as downloaded. Artists are now sorted by Deezer fan count, and on a local artist page (web) with a real collision the pick is tie-broken by **song overlap** with your library (each artist has different songs). The **fan count is shown** on search artist cards and on both the Deezer *and* local Navidrome artist pages (web + Android)
@@ -79,6 +80,7 @@ Big change: **the entire metadata/search stack moved from Apple's iTunes to Deez
- **Backend** — Unit tests for the Deezer mapping/matching logic (`backend/test/deezer.test.js`, run with `npm test`), incl. per-track numbering, mixed-artist album-artist stability, explicit flags and the Japanese-title match guard. A live smoke test runs with `RUN_LIVE=1`
### Fixed
- **Web** — Downloading a not-yet-owned album from an artist page searched YouTube for "**Unknown Artist** &lt;album&gt;" and failed. Deezer's `/artist/{id}/albums` omits the `artist` object, so the discography cards had an empty artist name → the modal fell back to the literal `"Unknown Artist"`. Fixed by backfilling the known artist name in `deezerLookupArtistAlbums` and defaulting the download modal to **Album** for album cards (was always **Track**)
- **Web + Android** — Owned albums were wrongly shown as **"Unvollständig 1 / 0 Tracks"** on the artist page. Deezer's `/artist/{id}/albums` list omits `nb_tracks`, so the total read as 0 and every matched album looked incomplete. Web now resolves the real track count from the Deezer album endpoint for **matched (owned) albums only** and treats an unknown total as complete; Android treats an unknown total as complete (never a false partial)
### Notes
@@ -415,7 +417,6 @@ Primary causes identified:
- **Web + Android** — yt-dlp backend update / maintenance
### Known Bugs
- **Web (download)** — Downloading a not-yet-owned album **straight from an artist page** can fail with "Nicht eindeutig gefunden" and search YouTube for "**Unknown Artist** &lt;album&gt;". Three causes combine: (1) Deezer's `/artist/{id}/albums` omits the `artist` object, so the discography cards carry an **empty artist name** (`_dzAlbum` → `artistName: ''`); (2) `openDlModal` defaults to **type=track** even for album cards (the `isAlbum` flag is ignored), so a one-click download treats the album as a single track named after the album; (3) `downloads.js` substitutes the literal string `"Unknown Artist"` for the empty name, which then poisons the yt-dlp search query **and** the `artist ~= Unknown` / `channel ~= Unknown` filter. Workaround: switch the type to *Album* in the modal, or use the direct-link importer. Not yet fixed.
- **Android (lyrics)** — Synced-lyrics auto-scroll is **not smooth**: it follows playback and highlights the right line, but the list jumps to it rather than gliding. Web autoscroll is smooth. Not yet fixed.
- **Web (PWA, desktop)** — The Windows media tile (SMTC) briefly closes and reopens when skipping tracks. Swapping the `<audio>` element's source leaves a momentary gap with no active media output, so Windows tears down and rebuilds the tile. A real fix needs one continuous source (MSE), which requires streaming an MSE-compatible format. The native Android app is unaffected. (The two-element gapless handoff added in 1.1 makes skips effectively instant but does **not** fix this — switching elements still ends and restarts the OS session.)
- **Backend (download)** — The duplicate check requires at least a `firstArtist` folder match. If the same song was previously stored under a very different artist name (e.g. before an iTunes-name fix), it will not be detected as a duplicate and will be re-downloaded.
+11 -11
View File
@@ -166,22 +166,22 @@
<div id="artist-songs-list"></div>
</div>
<!-- ITUNES ALBUM DETAIL -->
<div class="page" id="page-itunes-album-detail">
<button class="back-btn" id="itunes-album-back-btn"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>Zurück</button>
<!-- DEEZER ALBUM DETAIL -->
<div class="page" id="page-deezer-album-detail">
<button class="back-btn" id="deezer-album-back-btn"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg>Zurück</button>
<div class="album-header">
<div class="album-cover" id="itunes-album-cover-wrap"><div class="no-art">💿</div></div>
<div class="album-cover" id="deezer-album-cover-wrap"><div class="no-art">💿</div></div>
<div class="album-meta">
<div class="album-type">Deezer</div>
<div class="album-name" id="itunes-album-detail-name">—</div>
<div class="album-artist-name" id="itunes-album-detail-artist"></div>
<div class="album-stats" id="itunes-album-detail-stats"></div>
<div class="album-name" id="deezer-album-detail-name">—</div>
<div class="album-artist-name" id="deezer-album-detail-artist"></div>
<div class="album-stats" id="deezer-album-detail-stats"></div>
<div class="album-actions">
<button class="btn-outline" id="itunes-album-dl-btn"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Album laden</button>
<button class="btn-outline" id="deezer-album-dl-btn"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>Album laden</button>
</div>
</div>
</div>
<div id="itunes-album-songs"></div>
<div id="deezer-album-songs"></div>
</div>
<!-- PARTIAL ALBUM DETAIL (incomplete album: downloaded + missing tracks) -->
@@ -333,7 +333,7 @@
<div class="page" id="page-discover">
<div class="page-header">
<div class="page-title"><span class="blue">Global</span> Suche</div>
<span class="badge badge-itunes" style="font-size:11px;padding:4px 10px">Deezer</span>
<span class="badge badge-deezer" style="font-size:11px;padding:4px 10px">Deezer</span>
</div>
<div class="search-wrap" style="padding:0 0 20px">
<div class="search-box" style="background:var(--surface);border-color:var(--border2)">
@@ -350,7 +350,7 @@
<div class="page" id="page-new-releases">
<div class="page-header">
<div class="page-title">Neue <em>Releases</em></div>
<span class="badge badge-itunes" style="font-size:11px;padding:4px 10px">Deezer Charts</span>
<span class="badge badge-deezer" style="font-size:11px;padding:4px 10px">Deezer Charts</span>
</div>
<div class="section-header" style="margin-top:0"><span class="section-title">Top Alben weltweit</span></div>
<div id="nr-albums" class="grid grid-4"></div>
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE = 'ns-v61';
const CACHE = 'ns-v62';
const PRECACHE = ['/', 'index.html', 'manifest.json', 'icon.svg'];
const SKIP_PATHS = ['/rest/stream', '/rest/download', '/config.js'];
// Auth token params stripped from cache keys so artwork survives across sessions/token refreshes.
+20 -14
View File
@@ -271,7 +271,7 @@ export async function romajiConvert(texts) {
// Apple's iTunes /search returns 403 from server IPs, so Deezer is the metadata backend for
// everything: search, album/artist lookups AND the "Neu & Beliebt" charts. Free, no key, returns
// explicit versions + artist images + track durations. Proxied through the backend to avoid any
// CORS surprises. All results are mapped to the legacy "ItunesItem" shape so the UI + download
// CORS surprises. All results are mapped to the legacy "DeezerItem" shape so the UI + download
// flow stay unchanged.
function _deezerBase() {
return S.cfg.backendUrl ? `${S.cfg.backendUrl}/api/deezer` : 'https://api.deezer.com';
@@ -306,23 +306,23 @@ function _dzArtist(a) {
artistId: a.id, artistName: a.name,
artworkUrl100: a.picture_big || a.picture_medium || '',
// Deezer's artist search does NOT rank by popularity — several artists can share a name
// (5× "Joji"). fanCount lets us pick the one the user means (see itunesSearch + detail.js).
// (5× "Joji"). fanCount lets us pick the one the user means (see deezerSearch + detail.js).
fanCount: a.nb_fan ?? undefined,
};
}
// Last search outcome: null = ok, else HTTP status or 'network'. Read by the search view to tell
// "no results" apart from "search backend down".
let _itunesLastError = null;
export function itunesLastError() { return _itunesLastError; }
let _deezerLastError = null;
export function deezerLastError() { return _deezerLastError; }
// Keeps the old name so all callers stay unchanged. entity: musicTrack | album | musicArtist.
export async function itunesSearch(query, entity='musicTrack', limit=25) {
export async function deezerSearch(query, entity='musicTrack', limit=25) {
try {
const path = entity === 'album' ? 'search/album' : entity === 'musicArtist' ? 'search/artist' : 'search';
const r = await fetch(`${_deezerBase()}/${path}?q=${encodeURIComponent(query)}&limit=${limit}`);
if (!r.ok) { _itunesLastError = r.status; return []; }
_itunesLastError = null;
if (!r.ok) { _deezerLastError = r.status; return []; }
_deezerLastError = null;
const txt = await r.text();
const data = (txt ? JSON.parse(txt) : {}).data || [];
if (entity === 'album') return data.map(_dzAlbum);
@@ -330,12 +330,12 @@ export async function itunesSearch(query, entity='musicTrack', limit=25) {
// (Deezer returns them in an unhelpful order — the real "Joji" isn't first).
if (entity === 'musicArtist') return data.map(_dzArtist).sort((x, y) => (y.fanCount || 0) - (x.fanCount || 0));
return data.map(_dzTrack);
} catch { _itunesLastError = 'network'; return []; }
} catch { _deezerLastError = 'network'; return []; }
}
// Album tracks (for the album detail view + album download). Deezer's /album/{id} embeds tracks +
// album-level release/genre/cover, so one request gives everything.
export async function itunesLookupAlbum(collectionId) {
export async function deezerLookupAlbum(collectionId) {
try {
const r = await fetch(`${_deezerBase()}/album/${collectionId}`);
const a = await r.json();
@@ -351,17 +351,23 @@ export async function itunesLookupAlbum(collectionId) {
} catch { return []; }
}
export async function itunesLookupArtistSongs(artistId, limit=15) {
export async function deezerLookupArtistSongs(artistId, limit=15) {
try {
const r = await fetch(`${_deezerBase()}/artist/${artistId}/top?limit=${limit}`);
return ((await r.json()).data || []).map(_dzTrack);
} catch { return []; }
}
export async function itunesLookupArtistAlbums(artistId, limit=100) {
// Deezer's /artist/{id}/albums list OMITS the artist object, so _dzAlbum yields artistName:''.
// We already know whose page this is → backfill artistName so downstream download/detail cards
// don't fall back to the literal "Unknown Artist" (which poisoned the yt-dlp search).
export async function deezerLookupArtistAlbums(artistId, limit=100, artistName='') {
try {
const r = await fetch(`${_deezerBase()}/artist/${artistId}/albums?limit=${limit}`);
return ((await r.json()).data || []).map(_dzAlbum).filter(a => a.collectionType === 'Album');
return ((await r.json()).data || [])
.map(_dzAlbum)
.filter(a => a.collectionType === 'Album')
.map(a => (a.artistName ? a : { ...a, artistName }));
} catch { return []; }
}
@@ -375,7 +381,7 @@ export async function deezerArtistImage(artistId) {
// "Neu & Beliebt" — Deezer's global chart (Apple's charts RSS needed a proxy and the search
// fallback is 403 from server IPs). Mapped to { name, artistName, artworkUrl, artworkUrl100 }.
export async function itunesTopCharts() {
export async function deezerTopCharts() {
try {
const r = await fetch(`${_deezerBase()}/chart/0/albums?limit=50`);
const d = await r.json();
@@ -386,7 +392,7 @@ export async function itunesTopCharts() {
} catch { return []; }
}
export async function itunesTopSongs() {
export async function deezerTopSongs() {
try {
const r = await fetch(`${_deezerBase()}/chart/0/tracks?limit=50`);
const d = await r.json();
+2 -2
View File
@@ -15,7 +15,7 @@ import {
import {
navigate, _navGoBack, _navOnPopState, _navLoad, onHeaderSearch, closeHeaderSearch,
onGlobalSearch, s_goArtist, s_goAlbum, playerBarGoArtist, playerBarGoAlbum,
searchSimilarArtist, searchAndPreview, loadItunesAlbum, closeEventsModal,
searchSimilarArtist, searchAndPreview, loadDeezerAlbum, closeEventsModal,
loadAlbums, loadStarred, loadRandom, filterStarred, filterPlaylist,
plReorderEnter, plReorderSave, plReorderCancel, toggleAllGenres,
} from './views/views.js';
@@ -314,7 +314,7 @@ Object.assign(window, {
// Navigation
navigate, onHeaderSearch, closeHeaderSearch, onGlobalSearch, s_goArtist, s_goAlbum,
playerBarGoArtist, playerBarGoAlbum, searchSimilarArtist, searchAndPreview,
loadItunesAlbum, closeEventsModal,
loadDeezerAlbum, closeEventsModal,
// Player
playQueue, togglePlay, prevSong, nextSong, toggleShuffle, toggleRepeat,
toggleQueue, setVolume, seekTo, starCurrent, downloadCurrent, playPreview,
+1 -1
View File
@@ -75,7 +75,7 @@ export function makeSongItem(s, idx, list, { noArtistLink = false, singlePlay =
return el;
}
// ─── GLOBAL TRACK ITEM (iTunes / Spotify results) ───
// ─── GLOBAL TRACK ITEM (Deezer / Spotify results) ───
export function makeGlobalTrackItem(t, idx, list) {
const el = document.createElement('div');
el.className = 'gtrack-item';
+8 -5
View File
@@ -1,13 +1,16 @@
import { S } from '../state.js';
import { esc, toast } from '../utils.js';
import { api, fetchRomajiIndex, romajiConvert, getRomajiOverrides, invalidateRomajiIndex, itunesLookupAlbum } from '../api.js';
import { api, fetchRomajiIndex, romajiConvert, getRomajiOverrides, invalidateRomajiIndex, deezerLookupAlbum } from '../api.js';
import { _addNotif } from './notify.js';
// ─── DOWNLOAD MODAL ───
export function openDlModal(track) {
if(!S.cfg.backendUrl) { toast('⚠ Kein Backend konfiguriert. Bitte in Einstellungen eintragen.'); return; }
S.downloadTarget = track; S.dlType = 'track';
document.querySelectorAll('.modal-opt').forEach(o => o.classList.toggle('selected', o.dataset.type==='track'));
// Album cards pass isAlbum → default the modal to an album download, not a single track named
// after the album (a one-click download of an album card used to grab it as one "track").
const _defType = track.isAlbum ? 'album' : 'track';
S.downloadTarget = track; S.dlType = _defType;
document.querySelectorAll('.modal-opt').forEach(o => o.classList.toggle('selected', o.dataset.type===_defType));
const info = document.getElementById('dl-modal-info');
const art = track.artworkUrl100 || track.artworkUrl60 || '';
info.innerHTML = `${art ? `<div class="modal-art"><img src="${art}"></div>` : '<div class="modal-art" style="display:flex;align-items:center;justify-content:center;font-size:28px">🎵</div>'}
@@ -35,7 +38,7 @@ export async function executeDownload() {
title: _title,
album: _album,
artworkUrl: S.downloadTarget.artworkUrl100 || S.downloadTarget.artworkUrl60 || '',
itunesId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
deezerId: S.downloadTarget.trackId || S.downloadTarget.collectionId || null,
collectionId: S.downloadTarget.collectionId || null,
explicit: S.downloadTarget.trackExplicitness === 'explicit',
trackNum: S.downloadTarget.trackNumber || undefined,
@@ -51,7 +54,7 @@ export async function executeDownload() {
// request — the backend downloads that list directly (Apple's /search is 403, so no iTunes lookup).
if (S.dlType === 'album' && payload.collectionId) {
try {
const albumTracks = await itunesLookupAlbum(payload.collectionId);
const albumTracks = await deezerLookupAlbum(payload.collectionId);
if (albumTracks.length) payload.tracks = albumTracks;
} catch {}
}
+40 -40
View File
@@ -1,6 +1,6 @@
import { S } from '../state.js';
import { esc, toast, fmtCount } from '../utils.js';
import { api, coverUrl, itunesSearch, itunesLookupAlbum, itunesLookupArtistSongs, itunesLookupArtistAlbums, deezerArtistImage, fetchRomajiIndex, dispArtistById, dispAlbumName, cacheArtistSortNames, ensureArtistSortMap } from '../api.js';
import { api, coverUrl, deezerSearch, deezerLookupAlbum, deezerLookupArtistSongs, deezerLookupArtistAlbums, deezerArtistImage, fetchRomajiIndex, dispArtistById, dispAlbumName, cacheArtistSortNames, ensureArtistSortMap } from '../api.js';
import { makeCard, makeAlbumCard, makeGlobalTrackItem, makeSongItem } from '../ui/components.js';
import { playQueue, dlSongLocal, toggleStar, parseArtists } from '../player/player.js';
import { showCtxMenu, openDlModal } from '../ui/ui.js';
@@ -87,8 +87,8 @@ export async function loadArtistDetail(artist) {
if(albEl) albEl.innerHTML = '<div class="spinner"></div>';
const hasND = !!artist.id;
const knownItunes = artist.itunesArtistId || null;
const knownFans = artist.itunesFanCount ?? null;
const knownDeezer = artist.deezerArtistId || null;
const knownFans = artist.deezerFanCount ?? null;
if (knownFans) _showFans(knownFans); // from the global-search card — show immediately
// Fire all requests immediately so they run in parallel.
@@ -96,7 +96,7 @@ export async function loadArtistDetail(artist) {
const albumP = hasND ? api('getArtist', `&id=${artist.id}`) : Promise.resolve(null);
const infoP = hasND ? api('getArtistInfo2',`&id=${artist.id}&count=8`) : Promise.resolve(null);
const topP = hasND ? api('getTopSongs', `&artist=${encodeURIComponent(artist.name)}&count=10`) : Promise.resolve(null);
const iArtistP = knownItunes ? Promise.resolve([{ artistId: knownItunes }]) : itunesSearch(artist.name, 'musicArtist', 5);
const iArtistP = knownDeezer ? Promise.resolve([{ artistId: knownDeezer }]) : deezerSearch(artist.name, 'musicArtist', 5);
const eventsP = fetchEvents(artist.name);
// Phase 1 — hero: only wait for albumP (fast local Navidrome call, no external API).
@@ -138,7 +138,7 @@ export async function loadArtistDetail(artist) {
document.getElementById('artist-hero-pfp-initial')?.style.setProperty('display', 'none');
}).catch(() => {});
// Phase 2 — content (may be slow: Last.fm bio, iTunes, events)
// Phase 2 — content (may be slow: Last.fm bio, Deezer, events)
const [infoRes, topRes, iArtistRes, eventsRes] = await Promise.allSettled([infoP, topP, iArtistP, eventsP]);
const _normWords = s => new Set((s || '').toLowerCase().replace(/[^a-z0-9]/g, ' ').split(/\s+/).filter(Boolean));
@@ -163,7 +163,7 @@ export async function loadArtistDetail(artist) {
// artist we own songs for, prefer the Deezer candidate whose top tracks actually overlap our
// library — each artist has different songs, so this nails the right person. Only runs on a real
// collision (≥2 name matches) and costs a few calls just for those.
if (!knownItunes && hasND && nameMatches.length > 1) {
if (!knownDeezer && hasND && nameMatches.length > 1) {
const _nt = s => (s || '').toLowerCase().replace(/\([^)]*\)/g, '').replace(/[^a-z0-9]/g, '');
const refTitles = new Set(
((topRes.status === 'fulfilled' ? topRes.value?.topSongs?.song : []) || [])
@@ -172,7 +172,7 @@ export async function loadArtistDetail(artist) {
if (refTitles.size) {
const cands = nameMatches.slice(0, 3);
const scored = await Promise.all(cands.map(async c => {
const tt = await itunesLookupArtistSongs(c.artistId, 15).catch(() => []);
const tt = await deezerLookupArtistSongs(c.artistId, 15).catch(() => []);
const overlap = tt.reduce((n, t) => n + (refTitles.has(_nt(t.trackName)) ? 1 : 0), 0);
return { c, overlap };
}));
@@ -181,12 +181,12 @@ export async function loadArtistDetail(artist) {
}
}
const itunesArtistId = knownItunes ?? iArtistMatch?.artistId ?? null;
const deezerArtistId = knownDeezer ?? iArtistMatch?.artistId ?? null;
if (!knownFans) _showFans(iArtistMatch?.fanCount); // local artist: show the matched Deezer artist's fans
// Non-local (Deezer) artist has no Navidrome photo — fetch the Deezer artist picture for the hero.
if (!hasND && itunesArtistId && pfpWrap) {
const dzImg = iArtistMatch?.artworkUrl100 || await deezerArtistImage(itunesArtistId);
if (!hasND && deezerArtistId && pfpWrap) {
const dzImg = iArtistMatch?.artworkUrl100 || await deezerArtistImage(deezerArtistId);
if (dzImg) {
const pfpImg = document.createElement('img');
pfpImg.className = 'artist-hero-pfp';
@@ -197,10 +197,10 @@ export async function loadArtistDetail(artist) {
}
}
const [iAlbumsRes, iTracksRes] = itunesArtistId
const [iAlbumsRes, iTracksRes] = deezerArtistId
? await Promise.allSettled([
itunesLookupArtistAlbums(itunesArtistId),
itunesLookupArtistSongs(itunesArtistId, 15),
deezerLookupArtistAlbums(deezerArtistId, 100, artist.name),
deezerLookupArtistSongs(deezerArtistId, 15),
])
: [{ status: 'rejected' }, { status: 'rejected' }];
@@ -332,7 +332,7 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
await Promise.all(entries
.filter(e => e.match && !(e.ia.trackCount > 0) && e.ia.collectionId)
.map(async e => {
const tracks = await itunesLookupAlbum(e.ia.collectionId).catch(() => []);
const tracks = await deezerLookupAlbum(e.ia.collectionId).catch(() => []);
if (tracks.length) e.ia = { ...e.ia, trackCount: tracks.length };
}));
@@ -342,11 +342,11 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
if(!match) { notDl.push(ia); continue; }
const have = match.songCount || 0;
const total = ia.trackCount || 0;
if(total > have) { partial.push({ nd: match, itunes: ia, have, total }); usedNdIds.add(match.id); }
else { downloaded.push({ nd: match, itunes: ia }); usedNdIds.add(match.id); }
if(total > have) { partial.push({ nd: match, deezer: ia, have, total }); usedNdIds.add(match.id); }
else { downloaded.push({ nd: match, deezer: ia }); usedNdIds.add(match.id); }
}
for(const na of ndAlbums) {
if(!usedNdIds.has(na.id)) downloaded.push({ nd: na, itunes: null });
if(!usedNdIds.has(na.id)) downloaded.push({ nd: na, deezer: null });
}
el.innerHTML = '';
@@ -370,20 +370,20 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
}
if(partial.length) {
const g = addGrid('Unvollständig', partial.length);
partial.forEach(({ nd, itunes, have, total }) => {
const art = itunes?.artworkUrl100?.replace('100x100','512x512') || coverUrl(nd.coverArt, 512);
partial.forEach(({ nd, deezer, have, total }) => {
const art = deezer?.artworkUrl100?.replace('100x100','512x512') || coverUrl(nd.coverArt, 512);
const c = makeCard(nd.name, `${have} / ${total} Tracks`, art, '💿');
c.querySelector('.card-art').onclick = (e) => { e.stopPropagation(); quickPlayAlbum(nd); };
c.querySelector('.card-info').onclick = () => itunes ? navigate('partial-album-detail', { nd, itunes }) : navigate('album-detail', { ...nd, _fromArtist: artist });
c.querySelector('.card-info').onclick = () => deezer ? navigate('partial-album-detail', { nd, deezer }) : navigate('album-detail', { ...nd, _fromArtist: artist });
const artEl = c.querySelector('.card-art');
const badge = document.createElement('div');
badge.className = 'album-partial-badge'; badge.textContent = `${have}/${total}`;
artEl.appendChild(badge);
if(itunes) {
if(deezer) {
const btn = document.createElement('button');
btn.className = 'card-dl-btn'; btn.title = 'Fehlende Tracks laden';
btn.innerHTML = `<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`;
btn.onclick = (e) => { e.stopPropagation(); openDlModal({ artistName: artist.name, trackName: nd.name, collectionName: nd.name, artworkUrl100: itunes.artworkUrl100||'', isAlbum: true, itunesData: itunes, collectionId: itunes.collectionId }); };
btn.onclick = (e) => { e.stopPropagation(); openDlModal({ artistName: artist.name, trackName: nd.name, collectionName: nd.name, artworkUrl100: deezer.artworkUrl100||'', isAlbum: true, deezerData: deezer, collectionId: deezer.collectionId }); };
artEl.appendChild(btn);
}
g.appendChild(c);
@@ -394,12 +394,12 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
notDl.forEach(ia => {
const art = ia.artworkUrl100?.replace('100x100','300x300');
const c = makeCard(ia.collectionName, ia.releaseDate?.slice(0,4)||'', art, '💿');
c.onclick = () => navigate('itunes-album-detail', ia);
c.onclick = () => navigate('deezer-album-detail', ia);
const artEl = c.querySelector('.card-art');
const btn = document.createElement('button');
btn.className = 'card-dl-btn'; btn.title = 'Album laden';
btn.innerHTML = `<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`;
btn.onclick = (e) => { e.stopPropagation(); openDlModal({ artistName: ia.artistName, trackName: ia.collectionName, collectionName: ia.collectionName, artworkUrl100: ia.artworkUrl100||'', isAlbum: true, itunesData: ia, collectionId: ia.collectionId }); };
btn.onclick = (e) => { e.stopPropagation(); openDlModal({ artistName: ia.artistName, trackName: ia.collectionName, collectionName: ia.collectionName, artworkUrl100: ia.artworkUrl100||'', isAlbum: true, deezerData: ia, collectionId: ia.collectionId }); };
artEl.appendChild(btn);
g.appendChild(c);
});
@@ -438,32 +438,32 @@ export async function loadArtistAllSongs({ albums, artist }) {
});
}
export async function loadItunesAlbumDetail(album) {
document.getElementById('itunes-album-back-btn').onclick = () => _navGoBack();
document.getElementById('itunes-album-detail-name').textContent = album.collectionName || '—';
document.getElementById('itunes-album-detail-artist').textContent = album.artistName || '';
const cw = document.getElementById('itunes-album-cover-wrap');
export async function loadDeezerAlbumDetail(album) {
document.getElementById('deezer-album-back-btn').onclick = () => _navGoBack();
document.getElementById('deezer-album-detail-name').textContent = album.collectionName || '—';
document.getElementById('deezer-album-detail-artist').textContent = album.artistName || '';
const cw = document.getElementById('deezer-album-cover-wrap');
const art = (album.artworkUrl100 || '').replace('100x100bb','600x600bb').replace('100x100','600x600');
cw.innerHTML = art ? `<img src="${art}" onerror="_imgRetry(this,'💿')">` : '<div class="no-art">💿</div>';
const dlBtn = document.getElementById('itunes-album-dl-btn');
dlBtn.onclick = () => openDlModal({ artistName: album.artistName, trackName: album.collectionName, collectionName: album.collectionName, artworkUrl100: album.artworkUrl100||'', isAlbum: true, itunesData: album, collectionId: album.collectionId });
const sl = document.getElementById('itunes-album-songs');
const dlBtn = document.getElementById('deezer-album-dl-btn');
dlBtn.onclick = () => openDlModal({ artistName: album.artistName, trackName: album.collectionName, collectionName: album.collectionName, artworkUrl100: album.artworkUrl100||'', isAlbum: true, deezerData: album, collectionId: album.collectionId });
const sl = document.getElementById('deezer-album-songs');
sl.innerHTML = '<div class="spinner"></div>';
try {
const tracks = await itunesLookupAlbum(album.collectionId);
const tracks = await deezerLookupAlbum(album.collectionId);
const year = album.releaseDate ? new Date(album.releaseDate).getFullYear() : '';
document.getElementById('itunes-album-detail-stats').textContent = `${tracks.length} Titel${year ? ' · ' + year : ''}`;
document.getElementById('deezer-album-detail-stats').textContent = `${tracks.length} Titel${year ? ' · ' + year : ''}`;
sl.innerHTML = '';
if(!tracks.length) { sl.innerHTML = '<div style="padding:16px;color:var(--text3)">Keine Tracks gefunden</div>'; return; }
tracks.forEach((t, i) => sl.appendChild(makeGlobalTrackItem(t, i, tracks)));
} catch(e) { sl.innerHTML = `<p style="color:var(--danger)">${e.message}</p>`; }
}
export async function loadPartialAlbumDetail({ nd, itunes }) {
export async function loadPartialAlbumDetail({ nd, deezer }) {
document.getElementById('partial-album-back-btn').onclick = () => _navGoBack();
document.getElementById('partial-album-detail-name').textContent = nd.name || '—';
document.getElementById('partial-album-detail-artist').textContent = nd.artist || itunes?.artistName || '';
const art = (itunes?.artworkUrl100 || '').replace('100x100bb','600x600bb').replace('100x100','600x600')
document.getElementById('partial-album-detail-artist').textContent = nd.artist || deezer?.artistName || '';
const art = (deezer?.artworkUrl100 || '').replace('100x100bb','600x600bb').replace('100x100','600x600')
|| (nd.coverArt ? coverUrl(nd.coverArt, 512) : '');
const cw = document.getElementById('partial-album-cover-wrap');
cw.innerHTML = art ? `<img src="${art}" onerror="_imgRetry(this,'💿')">` : '<div class="no-art">💿</div>';
@@ -476,7 +476,7 @@ export async function loadPartialAlbumDetail({ nd, itunes }) {
try {
const [ndRes, iTracks] = await Promise.all([
api('getAlbum', `&id=${nd.id}`),
itunes?.collectionId ? itunesLookupAlbum(itunes.collectionId) : Promise.resolve([]),
deezer?.collectionId ? deezerLookupAlbum(deezer.collectionId) : Promise.resolve([]),
]);
const ndSongs = (ndRes.album?.song || []).sort((a,b) => (a.track||999)-(b.track||999));
@@ -492,9 +492,9 @@ export async function loadPartialAlbumDetail({ nd, itunes }) {
if(ndSongs.length) playQueue(ndSongs, 0);
};
// Download button offers missing via iTunes
// Download button offers missing via Deezer
document.getElementById('partial-album-dl-btn').onclick = () => {
if(itunes) openDlModal({ artistName: itunes.artistName, trackName: itunes.collectionName, collectionName: itunes.collectionName, artworkUrl100: itunes.artworkUrl100||'', isAlbum: true, itunesData: itunes, collectionId: itunes.collectionId });
if(deezer) openDlModal({ artistName: deezer.artistName, trackName: deezer.collectionName, collectionName: deezer.collectionName, artworkUrl100: deezer.artworkUrl100||'', isAlbum: true, deezerData: deezer, collectionId: deezer.collectionId });
};
// Section: downloaded
+9 -9
View File
@@ -1,11 +1,11 @@
import { S } from '../state.js';
import { esc } from '../utils.js';
import { itunesSearch, itunesTopCharts, itunesTopSongs } from '../api.js';
import { deezerSearch, deezerTopCharts, deezerTopSongs } from '../api.js';
import { makeCard, makeGlobalTrackItem } from '../ui/components.js';
import { playPreview } from '../player/player.js';
import { openDlModal } from '../ui/ui.js';
// Circular — safe (called inside event handlers)
import { loadItunesAlbum, searchAndPreview } from './search.js';
import { loadDeezerAlbum, searchAndPreview } from './search.js';
// ─── NEW RELEASES ───
export async function loadNewReleases() {
@@ -13,12 +13,12 @@ export async function loadNewReleases() {
const songEl = document.getElementById('nr-songs');
albumEl.innerHTML = '<div class="spinner"></div>'; songEl.innerHTML = '';
try {
const [albums, songs] = await Promise.all([itunesTopCharts(), itunesTopSongs()]);
const [albums, songs] = await Promise.all([deezerTopCharts(), deezerTopSongs()]);
albumEl.innerHTML = '';
albums.slice(0,30).forEach(a => {
const art = a.artworkUrl100?.replace('100x100','300x300') || a.artworkUrl;
const c = makeCard(a.name, a.artistName, art, '💿');
c.onclick = () => itunesSearch(a.name+' '+a.artistName,'album',5).then(res => { if(res[0]) loadItunesAlbum(res[0]); });
c.onclick = () => deezerSearch(a.name+' '+a.artistName,'album',5).then(res => { if(res[0]) loadDeezerAlbum(res[0]); });
albumEl.appendChild(c);
});
songs.slice(0,40).forEach((s, i) => {
@@ -36,7 +36,7 @@ export async function loadNewReleases() {
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
</button>
</div>`;
el.onclick = () => { itunesSearch(s.name+' '+s.artistName,'musicTrack',1).then(res => { if(res[0]?.previewUrl) playPreview(res[0]); }); };
el.onclick = () => { deezerSearch(s.name+' '+s.artistName,'musicTrack',1).then(res => { if(res[0]?.previewUrl) playPreview(res[0]); }); };
songEl.appendChild(el);
});
} catch(e) { albumEl.innerHTML = `<p style="color:var(--danger)">${e.message}</p>`; }
@@ -62,7 +62,7 @@ export async function loadRecommendations() {
if(S.cfg.lastfmKey) {
await _loadLastfmRecommendations(el, artist, title, html);
} else {
await _loadItunesFallbackRecommendations(el, artist, title, html);
await _loadDeezerFallbackRecommendations(el, artist, title, html);
const note = document.createElement('div');
note.style.cssText = 'margin-top:16px;padding:12px;background:var(--bg2);border:1px solid var(--border);border-radius:8px;font-size:12px;color:var(--text3)';
note.innerHTML = '💡 <strong>Tipp:</strong> Füge einen Last.fm API Key in den Einstellungen hinzu für bessere Empfehlungen & Similar Artists.';
@@ -123,11 +123,11 @@ async function _loadLastfmRecommendations(el, artist, title, html) {
});
sec.appendChild(list); el.appendChild(sec);
}
} catch { await _loadItunesFallbackRecommendations(el, artist, title, html); }
} catch { await _loadDeezerFallbackRecommendations(el, artist, title, html); }
}
async function _loadItunesFallbackRecommendations(el, artist, title, html) {
const results = await itunesSearch(artist, 'musicTrack', 20);
async function _loadDeezerFallbackRecommendations(el, artist, title, html) {
const results = await deezerSearch(artist, 'musicTrack', 20);
el.innerHTML = html;
const sec = document.createElement('div');
sec.innerHTML = `<div class="section-title" style="margin-bottom:10px">Mehr von ${esc(artist)}</div>`;
+2 -2
View File
@@ -5,7 +5,7 @@ import { loadSpotifyImporter } from './spotify.js';
import { loadSoundCloudImporter } from './soundcloud.js';
// Circular — safe (all calls happen inside function bodies)
import { loadHomeData, loadAlbumRow, loadArtists, loadAlbums, loadGenreDetail } from './home.js';
import { loadArtistDetail, loadArtistAllSongs, loadAlbumDetail, loadItunesAlbumDetail, loadPartialAlbumDetail } from './detail.js';
import { loadArtistDetail, loadArtistAllSongs, loadAlbumDetail, loadDeezerAlbumDetail, loadPartialAlbumDetail } from './detail.js';
import { loadPlaylists, loadPlaylistDetail, loadStarred, loadRandom } from './playlists.js';
import { loadNewReleases, loadRecommendations } from './discover.js';
import { invalidateApiCache } from '../api.js';
@@ -79,7 +79,7 @@ export function navigate(page, data=null) {
if(page==='artist-all-songs' && data) loadArtistAllSongs(data);
if(page==='album-detail' && data) loadAlbumDetail(data);
if(page==='genre-detail' && data) loadGenreDetail(data);
if(page==='itunes-album-detail' && data) loadItunesAlbumDetail(data);
if(page==='deezer-album-detail' && data) loadDeezerAlbumDetail(data);
if(page==='partial-album-detail' && data) loadPartialAlbumDetail(data);
if(page==='new-releases') loadNewReleases();
if(page==='playlists') loadPlaylists();
+17 -17
View File
@@ -1,6 +1,6 @@
import { S } from '../state.js';
import { esc, toast, fmtCount } from '../utils.js';
import { api, itunesSearch, itunesLastError, itunesLookupAlbum, fetchRomajiIndex, dispArtistById } from '../api.js';
import { api, deezerSearch, deezerLastError, deezerLookupAlbum, fetchRomajiIndex, dispArtistById } from '../api.js';
import { makeCard, makeAlbumCard, makeGlobalTrackItem, makeSongItem, mkSection } from '../ui/components.js';
import { playPreview } from '../player/player.js';
import { openDlModal } from '../ui/ui.js';
@@ -106,7 +106,7 @@ export function onHeaderSearch(val) {
export function onMobileSearch(val) { onHeaderSearch(val); }
// ─── GLOBAL (ITUNES) SEARCH ───
// ─── GLOBAL (DEEZER) SEARCH ───
export function onGlobalSearch(val) {
clearTimeout(S.globalSearchTimer);
const el = document.getElementById('global-search-results');
@@ -119,9 +119,9 @@ export async function doGlobalSearch(q) {
const el = document.getElementById('global-search-results');
try {
const [tracks, albums, artists] = await Promise.all([
itunesSearch(q,'musicTrack',25),
itunesSearch(q,'album',10),
itunesSearch(q,'musicArtist',6),
deezerSearch(q,'musicTrack',25),
deezerSearch(q,'album',10),
deezerSearch(q,'musicArtist',6),
]);
el.innerHTML = '';
const trackResults = tracks.filter(t => t.wrapperType === 'track');
@@ -132,10 +132,10 @@ export async function doGlobalSearch(q) {
artists.forEach(a => {
const sub = a.fanCount ? `${fmtCount(a.fanCount)} Fans` : 'Deezer Künstler';
const c = makeCard(a.artistName, sub, a.artworkUrl100 || null, '🎤');
c.onclick = () => loadItunesArtistResults(a.artistId, a.artistName, a.fanCount);
c.onclick = () => loadDeezerArtistResults(a.artistId, a.artistName, a.fanCount);
row.appendChild(c);
if (a.artworkUrl100) return; // Deezer artists already carry a photo — no extra lookup
itunesSearch(a.artistName,'album',1).then(res => {
deezerSearch(a.artistName,'album',1).then(res => {
if(!res[0]) return;
const imgUrl = res[0].artworkUrl100?.replace('100x100','300x300');
if(!imgUrl) return;
@@ -157,15 +157,15 @@ export async function doGlobalSearch(q) {
albums.forEach(a => {
const art = a.artworkUrl100?.replace('100x100','300x300');
const c = makeCard(a.collectionName, a.artistName, art, '💿');
c.querySelector('.play-btn').onclick = (e) => { e.stopPropagation(); loadItunesAlbum(a); };
c.querySelector('.play-btn').onclick = (e) => { e.stopPropagation(); loadDeezerAlbum(a); };
c.querySelector('.dl-btn-overlay')?.remove();
const dlOverlay = document.createElement('button');
dlOverlay.className = 'dl-btn-overlay';
dlOverlay.title = 'Auf Server laden';
dlOverlay.innerHTML = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>`;
dlOverlay.onclick = (e) => { e.stopPropagation(); openDlModal({artistName:a.artistName,trackName:a.collectionName,artworkUrl100:a.artworkUrl100,collectionName:a.collectionName,isAlbum:true,itunesData:a}); };
dlOverlay.onclick = (e) => { e.stopPropagation(); openDlModal({artistName:a.artistName,trackName:a.collectionName,artworkUrl100:a.artworkUrl100,collectionName:a.collectionName,isAlbum:true,deezerData:a}); };
c.querySelector('.play-overlay').appendChild(dlOverlay);
c.onclick = () => loadItunesAlbum(a);
c.onclick = () => loadDeezerAlbum(a);
row.appendChild(c);
});
s.appendChild(row); el.appendChild(s);
@@ -177,7 +177,7 @@ export async function doGlobalSearch(q) {
s.appendChild(list); el.appendChild(s);
}
if(!artists.length && !albums.length && !trackResults.length) {
const err = itunesLastError();
const err = deezerLastError();
if (err) {
// Distinguish "genuinely no results" from "search backend is down" so the user knows where
// the problem is.
@@ -192,9 +192,9 @@ export async function doGlobalSearch(q) {
} catch(e) { el.innerHTML = `<p style="color:var(--danger)">Suche fehlgeschlagen: ${e.message}</p>`; }
}
export async function loadItunesAlbum(album) {
export async function loadDeezerAlbum(album) {
try {
const tracks = await itunesLookupAlbum(album.collectionId);
const tracks = await deezerLookupAlbum(album.collectionId);
if(!tracks.length) { toast('Keine Tracks gefunden'); return; }
const el = document.getElementById('global-search-results');
const s = document.createElement('div'); s.className = 'search-section';
@@ -204,7 +204,7 @@ export async function loadItunesAlbum(album) {
<div style="font-size:15px;font-weight:700">${esc(album.collectionName)}</div>
<div style="font-size:12px;color:var(--text2)">${esc(album.artistName)}</div>
</div>
<button class="btn-outline blue" style="font-size:12px;padding:7px 12px" onclick="openDlModal({artistName:'${esc(album.artistName)}',trackName:'${esc(album.collectionName)}',artworkUrl100:'${album.artworkUrl100||''}',collectionName:'${esc(album.collectionName)}',isAlbum:true,itunesData:${JSON.stringify(album).replace(/"/g,'&quot;')}})">⬇ Album laden</button>
<button class="btn-outline blue" style="font-size:12px;padding:7px 12px" onclick="openDlModal({artistName:'${esc(album.artistName)}',trackName:'${esc(album.collectionName)}',artworkUrl100:'${album.artworkUrl100||''}',collectionName:'${esc(album.collectionName)}',isAlbum:true,deezerData:${JSON.stringify(album).replace(/"/g,'&quot;')}})">⬇ Album laden</button>
</div>
<div class="search-section-title">Tracks</div>`;
const list = document.createElement('div'); list.className = 'song-list';
@@ -214,8 +214,8 @@ export async function loadItunesAlbum(album) {
} catch(e) { toast('Fehler: ' + e.message); }
}
export function loadItunesArtistResults(artistId, artistName, fanCount) {
navigate('artist-detail', { id: null, name: artistName, itunesArtistId: artistId, itunesFanCount: fanCount });
export function loadDeezerArtistResults(artistId, artistName, fanCount) {
navigate('artist-detail', { id: null, name: artistName, deezerArtistId: artistId, deezerFanCount: fanCount });
}
// ─── SEARCH HELPERS ───
@@ -227,7 +227,7 @@ export function searchSimilarArtist(artistName) {
export async function searchAndPreview(trackName, artistName) {
try {
const res = await itunesSearch(trackName+' '+artistName, 'musicTrack', 1);
const res = await deezerSearch(trackName+' '+artistName, 'musicTrack', 1);
if(res[0]?.previewUrl) playPreview(res[0]); else toast('Kein Preview verfügbar');
} catch { toast('Suche fehlgeschlagen'); }
}
+4 -4
View File
@@ -1,6 +1,6 @@
import { S } from '../state.js';
import { esc, toast } from '../utils.js';
import { itunesSearch } from '../api.js';
import { deezerSearch } from '../api.js';
// Circular imports — safe (only used inside function bodies)
import { makeGlobalTrackItem } from '../ui/components.js';
import { openDlModal } from '../ui/ui.js';
@@ -236,7 +236,7 @@ function _renderSpotifyPreview(data) {
(data.tracks || []).forEach((t, i) => list.appendChild(makeGlobalTrackItem(t, i, data.tracks)));
section.style.display = '';
// Lazy-load correct per-track artwork and canonical names via iTunes in the background
// Lazy-load correct per-track artwork and canonical names via Deezer in the background
if (count > 0 && S.cfg.backendUrl) {
_loadSpotifyTrackArtwork(data.tracks, list);
}
@@ -284,7 +284,7 @@ async function _loadSpotifyTrackArtwork(tracks, listEl) {
const idx = i + bi;
try {
const firstArtist = (t.artistName || '').split(/\s*[,/•]\s*/)[0].trim();
const results = await itunesSearch(`${t.trackName} ${firstArtist}`, 'musicTrack', 1);
const results = await deezerSearch(`${t.trackName} ${firstArtist}`, 'musicTrack', 1);
const match = results[0];
if (!match) return;
// Always safe to enrich: artwork, preview, explicit, canonical artist name
@@ -305,7 +305,7 @@ 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;
// Only use iTunes duration if it looks like a full song (> 30s) — jingles/previews
// Only use Deezer 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;
}
+1 -1
View File
@@ -209,7 +209,7 @@ nav{flex:1;overflow-y:auto;padding:4px 10px}
/* ── BADGES ── */
.badge{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:600;padding:3px 8px;border-radius:20px;letter-spacing:.3px}
.badge-new{background:var(--blue-dim);color:var(--blue)}
.badge-itunes{background:rgba(252,100,100,.12);color:#fc6464}
.badge-deezer{background:rgba(252,100,100,.12);color:#fc6464}
.badge-local{background:var(--green-dim);color:var(--green)}
/* ── GLOBAL SEARCH RESULTS ── */