mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
address comments
This commit is contained in:
parent
9eef570740
commit
85a10c799a
5 changed files with 29 additions and 21 deletions
|
|
@ -2,12 +2,14 @@ import axios, { AxiosResponse } from 'axios';
|
|||
import { load } from 'cheerio';
|
||||
import type { QueueSong } from '/@/renderer/api/types';
|
||||
|
||||
const search_url = 'https://genius.com/api/search/song';
|
||||
const SEARCH_URL = 'https://genius.com/api/search/song';
|
||||
|
||||
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/genius.ts
|
||||
|
||||
async function getSongURL(metadata: QueueSong) {
|
||||
let result: AxiosResponse<any, any>;
|
||||
try {
|
||||
result = await axios.get(search_url, {
|
||||
result = await axios.get(SEARCH_URL, {
|
||||
params: {
|
||||
per_page: '1',
|
||||
q: `${metadata.artistName} ${metadata.name}`,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import type { QueueSong } from '/@/renderer/api/types';
|
|||
const SEARCH_URL = 'https://music.163.com/api/search/get';
|
||||
const LYRICS_URL = 'https://music.163.com/api/song/lyric';
|
||||
|
||||
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts
|
||||
|
||||
async function getSongId(metadata: QueueSong) {
|
||||
let result: AxiosResponse<any, any>;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
import { IpcRendererEvent, ipcRenderer } from 'electron';
|
||||
import { QueueSong } from '/@/renderer/api/types';
|
||||
|
||||
const fetchLyrics = (song: QueueSong) => {
|
||||
const fetchRemoteLyrics = (song: QueueSong) => {
|
||||
ipcRenderer.send('lyric-fetch', song);
|
||||
};
|
||||
|
||||
const getLyrics = (
|
||||
const retrieveRemoteLyrics = (
|
||||
cb: (event: IpcRendererEvent, songName: string, source: string, lyric: string) => void,
|
||||
) => {
|
||||
ipcRenderer.on('lyric-get', cb);
|
||||
};
|
||||
|
||||
export const lyrics = {
|
||||
fetchLyrics,
|
||||
getLyrics,
|
||||
fetchRemoteLyrics,
|
||||
retrieveRemoteLyrics,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue