fix(lyrics): fix camelCase mismatch between Rust and TypeScript
Rust sends syncedLrc (camelCase) but TypeScript expected synced_lrc. Updated TypeScript interface to match Rust serialization.
This commit is contained in:
1 parent
ab705db9cd
commit
b171a17b57
1 file changed
+8
-8
@@ -10,13 +10,13 @@ import { getCurrentTrack, getCurrentTime, subscribe as subscribePlayer } from '.
|
|||||||
// ============ Types ============
|
// ============ Types ============
|
||||||
|
|
||||||
export interface LyricsPayload {
|
export interface LyricsPayload {
|
||||||
track_id: number | null;
|
trackId: number | null;
|
||||||
title: string;
|
title: string;
|
||||||
artist: string;
|
artist: string;
|
||||||
album: string | null;
|
album: string | null;
|
||||||
duration_secs: number | null;
|
durationSecs: number | null;
|
||||||
plain: string | null;
|
plain: string | null;
|
||||||
synced_lrc: string | null;
|
syncedLrc: string | null;
|
||||||
provider: 'lrclib' | 'ovh';
|
provider: 'lrclib' | 'ovh';
|
||||||
cached: boolean;
|
cached: boolean;
|
||||||
}
|
}
|
||||||
@@ -161,8 +161,8 @@ function parsePlain(plain: string): LyricsLine[] {
|
|||||||
* Parse lyrics payload into lines
|
* Parse lyrics payload into lines
|
||||||
*/
|
*/
|
||||||
function parsePayload(p: LyricsPayload): ParsedLyrics {
|
function parsePayload(p: LyricsPayload): ParsedLyrics {
|
||||||
if (p.synced_lrc && p.synced_lrc.trim()) {
|
if (p.syncedLrc && p.syncedLrc.trim()) {
|
||||||
const lines = parseLRC(p.synced_lrc);
|
const lines = parseLRC(p.syncedLrc);
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
return { lines, isSynced: true };
|
return { lines, isSynced: true };
|
||||||
}
|
}
|
||||||
@@ -292,9 +292,9 @@ export async function fetchLyrics(): Promise<void> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Explicit logging - no objects to expand
|
// Explicit logging - no objects to expand
|
||||||
console.log(`[Lyrics] Backend: hasResult=${!!result}, hasSyncedLrc=${!!result?.synced_lrc}, syncedLen=${result?.synced_lrc?.length ?? 0}, hasPlain=${!!result?.plain}, provider=${result?.provider}`);
|
console.log(`[Lyrics] Backend: hasResult=${!!result}, hasSyncedLrc=${!!result?.syncedLrc}, syncedLen=${result?.syncedLrc?.length ?? 0}, hasPlain=${!!result?.plain}, provider=${result?.provider}`);
|
||||||
if (result?.synced_lrc) {
|
if (result?.syncedLrc) {
|
||||||
console.log(`[Lyrics] Synced LRC preview: ${result.synced_lrc.substring(0, 150)}`);
|
console.log(`[Lyrics] Synced LRC preview: ${result.syncedLrc.substring(0, 150)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|||||||
Reference in new issue
Block a user