type number to track title

This commit is contained in:
2026-02-06 06:44:45 -08:00
parent d5ed0e251c
commit 42d8e8fa8d

View File

@@ -82,16 +82,23 @@ export function createMediaSessionBindings(
return; return;
} }
const songTypeMap = { function typeNumberLabel(t: Track) {
"0": "UNKNOWN", const type = t.type;
"1": "OP", const n = Number(t.number ?? 0);
"2": "ED",
"3": "INS", let typeLabel: string | null = null;
}; if (typeof type === "number") {
if (type === 1) typeLabel = "OP";
else if (type === 2) typeLabel = "ED";
else if (type === 3) typeLabel = "INS";
else typeLabel = `T${type}`;
}
if (!typeLabel) return null;
return `${typeLabel}${n ? String(n) : ""}`;
}
mediaSession.metadata = new MediaMetadata({ mediaSession.metadata = new MediaMetadata({
title: title: ` ${typeNumberLabel(track)}${track.title}`,
track.animeName +
` (${songTypeMap[track.type || "0"] ?? ""}${track.number ?? ""}) — ${track.title}`,
artist: track.artist, artist: track.artist,
album: track.album, album: track.album,
// You can add artwork later if/when you have it: // You can add artwork later if/when you have it: