2023-06-09 02:36:38 -07:00
|
|
|
import { ipcRenderer } from 'electron';
|
2025-05-18 14:03:18 -07:00
|
|
|
|
2023-07-23 12:23:18 +00:00
|
|
|
import {
|
|
|
|
|
InternetProviderLyricSearchResponse,
|
|
|
|
|
LyricGetQuery,
|
|
|
|
|
LyricSearchQuery,
|
|
|
|
|
LyricSource,
|
2025-05-18 14:03:18 -07:00
|
|
|
} from '../main/features/core/lyrics';
|
2023-05-28 14:31:49 -07:00
|
|
|
|
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;
|
2023-05-28 14:31:49 -07:00
|
|
|
};
|
|
|
|
|
|
2023-07-23 12:23:18 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
2023-07-23 12:23:18 +00:00
|
|
|
const getRemoteLyricsByRemoteId = (id: LyricGetQuery) => {
|
2023-07-01 19:10:05 -07:00
|
|
|
const result = ipcRenderer.invoke('lyric-by-remote-id', id);
|
|
|
|
|
return result;
|
2023-05-28 14:31:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const lyrics = {
|
2023-07-01 19:10:05 -07:00
|
|
|
getRemoteLyricsByRemoteId,
|
|
|
|
|
getRemoteLyricsBySong,
|
|
|
|
|
searchRemoteLyrics,
|
2023-05-28 14:31:49 -07:00
|
|
|
};
|
2023-07-23 12:23:18 +00:00
|
|
|
|
|
|
|
|
export type Lyrics = typeof lyrics;
|