Fix: odstrani podvojen izvajalec v naslovu komada

This commit is contained in:
Sebastjan 2026-07-07 09:16:32 +00:00
parent b14fbc5d5f
commit 675d8789b1

View File

@ -130,8 +130,12 @@ function mapNowPlaying(np) {
const camp = (np.campaign || '').toUpperCase(); const camp = (np.campaign || '').toUpperCase();
if (type === 'song') { if (type === 'song') {
const artist = (np.artist || '').trim(); const artist = (np.artist || '').trim();
const title = (np.display_title || np.title || '').trim(); let title = (np.display_title || np.title || '').trim();
const label = artist ? `${artist}${title}` : title; // 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 }; return { kind: 'song', label, artist, title, started_at: np.started_at };
} }
if (type === 'spot') { if (type === 'spot') {