mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-23 02:46:40 +02:00
Add support for OpenSubsonic enhanced lyrics (#2208)
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user