diff --git a/src/now-playing/icy-now-playing.service.ts b/src/now-playing/icy-now-playing.service.ts index edcd9b1..767ba88 100644 --- a/src/now-playing/icy-now-playing.service.ts +++ b/src/now-playing/icy-now-playing.service.ts @@ -141,9 +141,16 @@ export class IcyNowPlayingService { resolve(null); return; } - const parts = match[1].split(' - ', 2); + const raw = match[1].trim(); + // Некоторые потоки (101.ru и др.) шлют в StreamTitle JSON-статус, + // а не название трека — это не трек, отсекаем. + if (raw.startsWith('{') || raw.startsWith('[')) { + resolve(null); + return; + } + const parts = raw.split(' - ', 2); if (parts.length < 2) { - resolve({ artist: match[1], song: match[1] }); + resolve({ artist: raw, song: raw }); } else { resolve({ artist: parts[0].trim(), diff --git a/src/now-playing/now-playing.service.ts b/src/now-playing/now-playing.service.ts index e30a99c..7c31af1 100644 --- a/src/now-playing/now-playing.service.ts +++ b/src/now-playing/now-playing.service.ts @@ -134,6 +134,15 @@ export class NowPlayingService { coverUrl?: string | null; }): Promise { const { stationDbId, stationNumericId, artist, song } = params; + + // Отсекаем мусор: пустое или JSON-статус в полях (некоторые потоки шлют + // в метаданных {"status":...} вместо трека). + const a = (artist ?? '').trim(); + const s = (song ?? '').trim(); + if (!a || !s || a.startsWith('{') || a.startsWith('[') || s.startsWith('{')) { + return; + } + const coverUrl = await this.resolveCover(artist, song, params.coverUrl); const prev = await this.prisma.nowPlaying.findUnique({