mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Improved lyric syncing, fetch
- uses a somewhat more sane way to parse lyrics and teardown timeouts - adds 'seeked' to setCurrentTime to make detecting seeks in lyric much easier - adds ability to fetch lyrics from genius/netease (desktop only)
This commit is contained in:
parent
23f9bd4e9f
commit
85d2576bdc
25 changed files with 907 additions and 118 deletions
17
src/main/preload/lyrics.ts
Normal file
17
src/main/preload/lyrics.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { IpcRendererEvent, ipcRenderer } from 'electron';
|
||||
import { QueueSong } from '/@/renderer/api/types';
|
||||
|
||||
const fetchLyrics = (song: QueueSong) => {
|
||||
ipcRenderer.send('lyric-fetch', song);
|
||||
};
|
||||
|
||||
const getLyrics = (
|
||||
cb: (event: IpcRendererEvent, songName: string, source: string, lyric: string) => void,
|
||||
) => {
|
||||
ipcRenderer.on('lyric-get', cb);
|
||||
};
|
||||
|
||||
export const lyrics = {
|
||||
fetchLyrics,
|
||||
getLyrics,
|
||||
};
|
||||
|
|
@ -78,6 +78,10 @@ const quit = () => {
|
|||
ipcRenderer.send('player-quit');
|
||||
};
|
||||
|
||||
const getCurrentTime = async () => {
|
||||
return ipcRenderer.invoke('player-get-time');
|
||||
};
|
||||
|
||||
const rendererAutoNext = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
||||
ipcRenderer.on('renderer-player-auto-next', cb);
|
||||
};
|
||||
|
|
@ -157,6 +161,7 @@ const rendererError = (cb: (event: IpcRendererEvent, data: string) => void) => {
|
|||
export const mpvPlayer = {
|
||||
autoNext,
|
||||
currentTime,
|
||||
getCurrentTime,
|
||||
initialize,
|
||||
mute,
|
||||
next,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue