feat(lyrics): simpmusic lyrics provider (#1820)

* feat(lyrics): simpmusic lyrics provider
This commit is contained in:
riccardo
2026-03-11 09:04:55 +01:00
committed by GitHub
parent f51d3d5711
commit 16ac536f93
4 changed files with 138 additions and 0 deletions
+8
View File
@@ -5,6 +5,10 @@ import { getLyricsBySongId as getGenius, getSearchResults as searchGenius } from
import { getLyricsBySongId as getLrcLib, getSearchResults as searchLrcLib } from './lrclib';
import { getLyricsBySongId as getNetease, getSearchResults as searchNetease } from './netease';
import { orderSearchResults } from './shared';
import {
getLyricsBySongId as getSimpMusic,
getSearchResults as searchSimpMusic,
} from './simpmusic';
import { Song } from '/@/shared/types/domain-types';
@@ -12,6 +16,7 @@ export enum LyricSource {
GENIUS = 'Genius',
LRCLIB = 'lrclib.net',
NETEASE = 'NetEase',
SIMPMUSIC = 'SimpMusic',
}
export type FullLyricsMetadata = Omit<InternetProviderLyricResponse, 'id' | 'lyrics' | 'source'> & {
@@ -66,12 +71,14 @@ const SEARCH_FETCHERS: Record<LyricSource, SearchFetcher> = {
[LyricSource.GENIUS]: searchGenius,
[LyricSource.LRCLIB]: searchLrcLib,
[LyricSource.NETEASE]: searchNetease,
[LyricSource.SIMPMUSIC]: searchSimpMusic,
};
const GET_FETCHERS: Record<LyricSource, GetFetcher> = {
[LyricSource.GENIUS]: getGenius,
[LyricSource.LRCLIB]: getLrcLib,
[LyricSource.NETEASE]: getNetease,
[LyricSource.SIMPMUSIC]: getSimpMusic,
};
const MAX_CACHED_ITEMS = 10;
@@ -191,6 +198,7 @@ const searchRemoteLyrics = async (params: LyricSearchQuery) => {
[LyricSource.GENIUS]: [],
[LyricSource.LRCLIB]: [],
[LyricSource.NETEASE]: [],
[LyricSource.SIMPMUSIC]: [],
};
for (const item of allSearchResults) {
results[item.source].push(item);