mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-23 20:37:42 +02:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { ipcRenderer } from 'electron';
|
|
|
|
import {
|
|
InternetProviderLyricSearchResponse,
|
|
LyricGetQuery,
|
|
LyricSearchQuery,
|
|
LyricSource,
|
|
} from '../main/features/core/lyrics';
|
|
|
|
import { QueueSong } from '/@/shared/types/domain-types';
|
|
|
|
const getRemoteLyricsBySong = (song: QueueSong) => {
|
|
const result = ipcRenderer.invoke('lyric-by-song', song);
|
|
return result;
|
|
};
|
|
|
|
const searchRemoteLyrics = (
|
|
params: LyricSearchQuery,
|
|
): Promise<Record<LyricSource, InternetProviderLyricSearchResponse[]>> => {
|
|
const result = ipcRenderer.invoke('lyric-search', params);
|
|
return result;
|
|
};
|
|
|
|
const getRemoteLyricsByRemoteId = (id: LyricGetQuery) => {
|
|
const result = ipcRenderer.invoke('lyric-by-remote-id', id);
|
|
return result;
|
|
};
|
|
|
|
const convertFurigana = (text: string): Promise<string> => {
|
|
return ipcRenderer.invoke('lyric-convert-furigana', text);
|
|
};
|
|
|
|
export const lyrics = {
|
|
convertFurigana,
|
|
getRemoteLyricsByRemoteId,
|
|
getRemoteLyricsBySong,
|
|
searchRemoteLyrics,
|
|
};
|
|
|
|
export type Lyrics = typeof lyrics;
|