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

@ -6,6 +6,7 @@ import { SongInfo } from '@/providers/song-info';
import { LRCLib } from './LRCLib';
import { LyricsGenius } from './LyricsGenius';
import { MusixMatch } from './MusixMatch';
import { YTMusic } from './YTMusic';
import { getSongInfo } from '@/providers/song-info-front';
@ -15,8 +16,8 @@ import type { LyricProvider, LyricResult } from '../types';
export const providers = {
YTMusic: new YTMusic(),
LRCLib: new LRCLib(),
MusixMatch: new MusixMatch(),
LyricsGenius: new LyricsGenius(),
// MusixMatch: new MusixMatch(),
// Megalobiz: new Megalobiz(), // Disabled because it is too unstable and slow
} as const;
@ -36,13 +37,10 @@ type LyricsStore = {
};
const initialData = () =>
providerNames.reduce(
(acc, name) => {
acc[name] = { state: 'fetching', data: null, error: null };
return acc;
},
{} as LyricsStore['lyrics'],
);
providerNames.reduce((acc, name) => {
acc[name] = { state: 'fetching', data: null, error: null };
return acc;
}, {} as LyricsStore['lyrics']);
export const [lyricsStore, setLyricsStore] = createStore<LyricsStore>({
provider: providerNames[0],
@ -136,6 +134,8 @@ export const fetchLyrics = (info: SongInfo) => {
pCache.state = 'error';
pCache.error = error;
console.error(error);
if (getSongInfo().videoId === info.videoId) {
setLyricsStore('lyrics', (old) => {
return {