feishin/src/main/preload/lyrics.ts

34 lines
848 B
TypeScript
Raw Normal View History

2023-06-09 02:36:38 -07:00
import { ipcRenderer } from 'electron';
import {
InternetProviderLyricSearchResponse,
LyricGetQuery,
LyricSearchQuery,
LyricSource,
QueueSong,
} from '/@/renderer/api/types';
2023-06-09 02:36:38 -07:00
const getRemoteLyricsBySong = (song: QueueSong) => {
2023-07-01 19:10:05 -07:00
const result = ipcRenderer.invoke('lyric-by-song', song);
return result;
};
const searchRemoteLyrics = (
params: LyricSearchQuery,
): Promise<Record<LyricSource, InternetProviderLyricSearchResponse[]>> => {
2023-07-01 19:10:05 -07:00
const result = ipcRenderer.invoke('lyric-search', params);
return result;
2023-06-08 03:40:34 -07:00
};
const getRemoteLyricsByRemoteId = (id: LyricGetQuery) => {
2023-07-01 19:10:05 -07:00
const result = ipcRenderer.invoke('lyric-by-remote-id', id);
return result;
};
export const lyrics = {
2023-07-01 19:10:05 -07:00
getRemoteLyricsByRemoteId,
getRemoteLyricsBySong,
searchRemoteLyrics,
};
export type Lyrics = typeof lyrics;