mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 20:40:15 +02:00
Add lyric search functions and query
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
SongDetailQuery,
|
||||
RandomSongListQuery,
|
||||
LyricsQuery,
|
||||
LyricSearchQuery,
|
||||
} from './types';
|
||||
|
||||
export const queryKeys: Record<
|
||||
@@ -107,6 +108,10 @@ export const queryKeys: Record<
|
||||
if (query) return [serverId, 'song', 'lyrics', query] as const;
|
||||
return [serverId, 'song', 'lyrics'] as const;
|
||||
},
|
||||
lyricsSearch: (query?: LyricSearchQuery) => {
|
||||
if (query) return ['lyrics', 'search', query] as const;
|
||||
return ['lyrics', 'search'] as const;
|
||||
},
|
||||
randomSongList: (serverId: string, query?: RandomSongListQuery) => {
|
||||
if (query) return [serverId, 'songs', 'randomSongList', query] as const;
|
||||
return [serverId, 'songs', 'randomSongList'] as const;
|
||||
|
||||
@@ -1036,6 +1036,13 @@ export type InternetProviderLyricResponse = {
|
||||
source: string;
|
||||
};
|
||||
|
||||
export type InternetProviderLyricSearchResponse = {
|
||||
artist: string;
|
||||
id: string;
|
||||
name: string;
|
||||
source: string;
|
||||
};
|
||||
|
||||
export type SynchronizedLyricMetadata = {
|
||||
lyrics: SynchronizedLyricsArray;
|
||||
remote: boolean;
|
||||
@@ -1053,3 +1060,8 @@ export type LyricOverride = Omit<InternetProviderLyricResponse, 'lyrics'>;
|
||||
export const instanceOfCancellationError = (error: any) => {
|
||||
return 'revert' in error;
|
||||
};
|
||||
|
||||
export type LyricSearchQuery = {
|
||||
artist: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user