Add support for OpenSubsonic enhanced lyrics (#2208)

This commit is contained in:
Jeff
2026-07-09 21:32:05 -07:00
committed by GitHub
parent 0c89fea1ea
commit 355b19c1cb
55 changed files with 4213 additions and 480 deletions
+31
View File
@@ -400,6 +400,7 @@ const serverInfo = z.object({
});
const structuredLyricsParameters = z.object({
enhanced: z.boolean().optional(),
id: z.string(),
});
@@ -408,9 +409,39 @@ const lyricLine = z.object({
value: z.string(),
});
const lyricAgentRole = z.enum(['main', 'voice', 'bg', 'group']);
const lyricAgent = z.object({
id: z.string(),
name: z.string().optional(),
role: lyricAgentRole,
});
const lyricCue = z.object({
byteEnd: z.number(),
byteStart: z.number(),
end: z.number(),
start: z.number(),
value: z.string(),
});
const lyricCueLine = z.object({
agentId: z.string().optional(),
cue: z.array(lyricCue).optional(),
end: z.number(),
index: z.number(),
start: z.number(),
value: z.string(),
});
const structuredLyricKind = z.enum(['main', 'translation', 'pronunciation']);
const structuredLyric = z.object({
agents: z.array(lyricAgent).optional(),
cueLine: z.array(lyricCueLine).optional(),
displayArtist: z.string().optional(),
displayTitle: z.string().optional(),
kind: structuredLyricKind.optional(),
lang: z.string(),
line: z.array(lyricLine),
offset: z.number().optional(),
+40 -3
View File
@@ -1349,17 +1349,25 @@ export type InternetProviderLyricSearchResponse = {
source: LyricSource;
};
export type LyricAgent = {
id: string;
name?: string;
role: 'bg' | 'group' | 'main' | 'voice';
};
export type LyricOverride = Omit<InternetProviderLyricResponse, 'lyrics'>;
export type LyricsArgs = BaseEndpointArgs & {
query: LyricsQuery;
};
export type LyricsKind = 'main' | 'pronunciation' | 'translation';
export type LyricsQuery = {
songId: string;
};
export type LyricsResponse = string | SynchronizedLyricsArray;
export type LyricsResponse = string | SynchronizedLyrics;
export type RandomSongListArgs = BaseEndpointArgs & {
query: RandomSongListQuery;
@@ -1435,7 +1443,34 @@ export type SearchSongsQuery = {
songStartIndex?: number;
};
export type SynchronizedLyricsArray = Array<[number, string]>;
export type SyncedCueLine = {
agentId?: string;
endMs: number;
index: number;
startMs: number;
value: string;
words: SyncedWordCue[];
};
export type SyncedWordCue = {
endMs: number;
startMs: number;
text: string;
};
export type SynchronizedLyricLine = {
cueLines?: SyncedCueLine[];
startMs: number;
text: string;
};
export type SynchronizedLyrics = SynchronizedLyricLine[];
/** @deprecated Use SynchronizedLyrics instead */
export type SynchronizedLyricsArray = SynchronizedLyrics;
/** @deprecated Use SynchronizedLyrics instead */
export type SynchronizedLyricsLineTuple = [number, string];
export type TopSongListArgs = BaseEndpointArgs & { query: TopSongListQuery };
@@ -1877,7 +1912,9 @@ export type StructuredLyricsArgs = BaseEndpointArgs & {
};
export type StructuredSyncedLyric = Omit<FullLyricsMetadata, 'lyrics'> & {
lyrics: SynchronizedLyricsArray;
agents?: LyricAgent[];
kind?: LyricsKind;
lyrics: SynchronizedLyrics;
synced: true;
};