fix(v2): align immersive track info/radio and i18n history keys

cx
This commit is contained in:
vicrodh committed 2026-02-16 19:27:47 -06:00
1 parent 37db48ea3d
commit 99877fa740
11 files changed
+130 -26

No files matched your search

+33 -12
View File
@@ -56,8 +56,8 @@
return role.replace(/([A-Z])/g, ' $1').trim().toUpperCase();
}
// Group performers by role and return ordered entries
function getGroupedCredits(performers: Performer[]): { role: string; names: string[] }[] {
// Group performers by role and return ordered entries
function getGroupedCredits(performers: Performer[]): { role: string; names: string[] }[] {
const grouped: Record<string, string[]> = {};
performers.forEach(performer => {
@@ -98,8 +98,25 @@
return a.localeCompare(b);
});
return entries.map(([role, names]) => ({ role, names }));
}
return entries.map(([role, names]) => ({ role, names }));
}
// Parse Qobuz performers string: "Name, Role - Name, Role"
function parsePerformers(performersStr?: string): Performer[] {
if (!performersStr) return [];
return performersStr
.split(' - ')
.map(segment => segment.trim())
.filter(Boolean)
.map(segment => {
const parts = segment.split(', ').map(p => p.trim()).filter(Boolean);
return {
name: parts[0] || '',
roles: parts.slice(1)
};
})
.filter(p => p.name.length > 0);
}
// Load track info when modal opens
$effect(() => {
@@ -111,14 +128,18 @@
}
});
async function loadTrackInfo(id: number) {
loading = true;
error = null;
try {
trackInfo = await invoke<TrackInfo>('get_track_info', { trackId: id });
} catch (e) {
error = e instanceof Error ? e.message : String(e);
trackInfo = null;
async function loadTrackInfo(id: number) {
loading = true;
error = null;
try {
const track = await invoke<TrackInfo['track']>('v2_get_track', { trackId: id });
trackInfo = {
track,
performers: parsePerformers(track.performers)
};
} catch (e) {
error = e instanceof Error ? e.message : String(e);
trackInfo = null;
} finally {
loading = false;
}
@@ -67,7 +67,7 @@
</div>
{:else}
<div class="empty-state">
<span>{$t('player.historyEmpty') || 'No history yet'}</span>
<span>{$t('player.noHistoryYet') || 'No history yet'}</span>
</div>
{/if}
</div>
@@ -153,7 +153,7 @@
</div>
{:else}
<div class="empty-state">
<span>{$t('player.historyEmpty') || 'No history yet'}</span>
<span>{$t('player.noHistoryYet') || 'No history yet'}</span>
</div>
{/if}
</div>
@@ -82,6 +82,23 @@
return entries.map(([role, names]) => ({ role, names }));
}
// Parse Qobuz performers string: "Name, Role - Name, Role"
function parsePerformers(performersStr?: string): Performer[] {
if (!performersStr) return [];
return performersStr
.split(' - ')
.map(segment => segment.trim())
.filter(Boolean)
.map(segment => {
const parts = segment.split(', ').map(p => p.trim()).filter(Boolean);
return {
name: parts[0] || '',
roles: parts.slice(1)
};
})
.filter(p => p.name.length > 0);
}
// Load track info only when trackId actually changes
$effect(() => {
if (trackId && trackId !== loadedTrackId) {
@@ -98,7 +115,11 @@
loading = true;
error = null;
try {
trackInfo = await invoke<TrackInfo>('get_track_info', { trackId: id });
const track = await invoke<TrackInfo['track']>('v2_get_track', { trackId: id });
trackInfo = {
track,
performers: parsePerformers(track.performers)
};
loadedTrackId = id;
} catch (e) {
error = e instanceof Error ? e.message : String(e);
+1
View File
@@ -377,6 +377,7 @@
"history": "Verlauf",
"recentlyPlayed": "Kürzlich gespielt",
"noHistoryYet": "Noch keine Titel abgespielt",
"historyEmpty": "Noch keine Titel abgespielt",
"infinitePlay": "Unendliches Abspielen",
"infinitePlayEnabled": "Unendliches Abspielen aktiviert",
"infinitePlayDisabled": "Unendliches Abspielen deaktiviert",
+1
View File
@@ -385,6 +385,7 @@
"history": "History",
"recentlyPlayed": "Recently Played",
"noHistoryYet": "No tracks played yet",
"historyEmpty": "No tracks played yet",
"infinitePlay": "Infinite Play",
"infinitePlayEnabled": "Infinite play enabled",
"infinitePlayDisabled": "Infinite play disabled",
+1
View File
@@ -385,6 +385,7 @@
"history": "Historial",
"recentlyPlayed": "Reproducido Recientemente",
"noHistoryYet": "Sin pistas reproducidas aún",
"historyEmpty": "Sin pistas reproducidas aún",
"infinitePlay": "Reproducción Infinita",
"infinitePlayEnabled": "Reproducción infinita activada",
"infinitePlayDisabled": "Reproducción infinita desactivada",
+1
View File
@@ -377,6 +377,7 @@
"history": "Historique",
"recentlyPlayed": "Récemment écouté",
"noHistoryYet": "Aucune piste lue pour l'instant",
"historyEmpty": "Aucune piste lue pour l'instant",
"infinitePlay": "Lecture infinie",
"infinitePlayEnabled": "Lecture infinie activée",
"infinitePlayDisabled": "Lecture infinie désactivée",