diff --git a/src/server.js b/src/server.js index f3c462c..088d798 100644 --- a/src/server.js +++ b/src/server.js @@ -130,8 +130,12 @@ function mapNowPlaying(np) { const camp = (np.campaign || '').toUpperCase(); if (type === 'song') { const artist = (np.artist || '').trim(); - const title = (np.display_title || np.title || '').trim(); - const label = artist ? `${artist} — ${title}` : title; + let title = (np.display_title || np.title || '').trim(); + // display_title je pogosto "Artist - Naslov"; ce se zacne z artistom, ga odstrani da ni podvojen + if (artist && title.toLowerCase().startsWith(artist.toLowerCase())) { + title = title.slice(artist.length).replace(/^\s*[-–—]\s*/, '').trim(); + } + const label = artist ? (title ? `${artist} — ${title}` : artist) : title; return { kind: 'song', label, artist, title, started_at: np.started_at }; } if (type === 'spot') {