Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/adapters/ExternalLyricAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { parseYrc } from "@/core/parsers/yrcParser";
import type { SongInfo } from "@/types/inflink";
import type { AmllLyricContent } from "@/types/ws";
import { LyricFormat, type LyricSource } from "@/utils/source";
import { isNonScrollingLyric } from "@/utils/lyricDetector";
import { BaseLyricAdapter } from "./BaseLyricAdapter";

export class ExternalLyricAdapter extends BaseLyricAdapter {
Expand Down Expand Up @@ -79,16 +80,30 @@ export class ExternalLyricAdapter extends BaseLyricAdapter {
const rawLrc = parseLrc(text);
if (rawLrc.length === 0) return null;

const lines = buildAmllLyricLines(rawLrc, [], []);

// 检测非滚动歌词
if (isNonScrollingLyric(lines)) {
console.log("[ExternalAdapter] LRC 歌词是非滚动歌词,触发 cover 模式");
return null;
}

return {
format: "structured",
lines: buildAmllLyricLines(rawLrc, [], []),
lines,
};
}

case LyricFormat.YRC: {
const yrcLines = parseYrc(text);
if (yrcLines.length === 0) return null;

// 检测非滚动歌词
if (isNonScrollingLyric(yrcLines)) {
console.log("[ExternalAdapter] YRC 歌词是非滚动歌词,触发 cover 模式");
return null;
}

return {
format: "structured",
lines: yrcLines,
Expand All @@ -99,6 +114,12 @@ export class ExternalLyricAdapter extends BaseLyricAdapter {
const lysLines = parseLys(text);
if (lysLines.length === 0) return null;

// 检测非滚动歌词
if (isNonScrollingLyric(lysLines)) {
console.log("[ExternalAdapter] LYS 歌词是非滚动歌词,触发 cover 模式");
return null;
}

return {
format: "structured",
lines: lysLines,
Expand All @@ -109,6 +130,12 @@ export class ExternalLyricAdapter extends BaseLyricAdapter {
const qrcLines = parseQrc(text);
if (qrcLines.length === 0) return null;

// 检测非滚动歌词
if (isNonScrollingLyric(qrcLines)) {
console.log("[ExternalAdapter] QRC 歌词是非滚动歌词,触发 cover 模式");
return null;
}

return {
format: "structured",
lines: qrcLines,
Expand Down
Loading
Loading