feishin/src/preload/lyrics.ts

36 lines
900 B
TypeScript
Raw Normal View History

2023-06-09 02:36:38 -07:00
import { ipcRenderer } from 'electron';
import {
InternetProviderLyricSearchResponse,
LyricGetQuery,
LyricSearchQuery,
LyricSource,
} from '../main/features/core/lyrics';
2025-05-20 19:23:36 -07:00
import { QueueSong } from '/@/shared/types/domain-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;