feat(synced-lyrics): Musixmatch (#3261)

This commit is contained in:
Angelos Bouklis
2025-06-30 16:37:01 +03:00
committed by GitHub
parent 89479a5045
commit eae4e952f5
7 changed files with 356 additions and 14 deletions

View File

@ -13,6 +13,10 @@ import type { SongInfo } from '@/providers/song-info';
import type { SyncedLyricsPluginConfig } from '../types';
export let _ytAPI: YoutubePlayer | null = null;
export let netFetch: (
url: string,
init?: RequestInit
) => Promise<[number, string, Record<string, string>]>;
export const renderer = createRenderer<
{
@ -53,7 +57,7 @@ export const renderer = createRenderer<
if (!this.updateTimestampInterval) {
this.updateTimestampInterval = setInterval(
() => setCurrentTime((_ytAPI?.getCurrentTime() ?? 0) * 1000),
100,
100
);
}
@ -73,6 +77,8 @@ export const renderer = createRenderer<
},
async start(ctx: RendererContext<SyncedLyricsPluginConfig>) {
netFetch = ctx.ipc.invoke.bind(ctx.ipc, 'synced-lyrics:fetch');
setConfig(await ctx.getConfig());
ctx.ipc.on('ytmd:update-song-info', (info: SongInfo) => {