mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-01 00:07:46 +02:00
fix: romaji duplicate lines for non-Japanese lyrics (#2188)
This commit is contained in:
@@ -42,13 +42,13 @@ export const convertFurigana = async (text: string): Promise<string> => {
|
||||
export const convertRomaji = async (text: string): Promise<string> => {
|
||||
const KuroshiroClass = (Kuroshiro as any).default || Kuroshiro;
|
||||
|
||||
if (!KuroshiroClass.Util.hasKana(text)) return text;
|
||||
if (!KuroshiroClass.Util.hasKana(text)) return '';
|
||||
|
||||
try {
|
||||
const kuroshiro = await getKuroshiro();
|
||||
return await kuroshiro.convert(text, { mode: 'spaced', to: 'romaji' });
|
||||
} catch (e) {
|
||||
console.error('Romaji conversion error: ', e);
|
||||
return text;
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ export const useRomajiLyrics = (lyrics: LyricsResponse | null | undefined, enabl
|
||||
const convertedLines = converted.split('\n');
|
||||
return lyrics.map(([time], i) => [
|
||||
time,
|
||||
convertedLines[i] ?? lyrics[i][1],
|
||||
convertedLines[i] ?? '',
|
||||
]) as SynchronizedLyricsArray;
|
||||
}
|
||||
return lyrics;
|
||||
|
||||
Reference in New Issue
Block a user