优化歌曲匹配

pull/392/head
lyswhut 2021-01-09 21:10:58 +08:00
parent 8b0779ac17
commit 8efeb169af
1 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ export default {
for (const source of sources.sources) { for (const source of sources.sources) {
if (!sources[source.id].musicSearch || source.id === musicInfo.source || source.id === 'xm') continue if (!sources[source.id].musicSearch || source.id === musicInfo.source || source.id === 'xm') continue
tasks.push(sources[source.id].musicSearch.search(`${musicInfo.name} ${musicInfo.singer || ''} ${musicInfo.albumName || ''}`.trim(), 1, { limit: 5 }).then(res => { tasks.push(sources[source.id].musicSearch.search(`${musicInfo.name} ${musicInfo.singer || ''}`.trim(), 1, { limit: 10 }).then(res => {
for (const item of res.list) { for (const item of res.list) {
if ( if (
( (
@ -80,7 +80,7 @@ export default {
return null return null
}).catch(_ => null)) }).catch(_ => null))
} }
const result = (await Promise.all(tasks)).filter(s => s) const result = (await Promise.all(tasks)).filter(s => s).reverse()
const newResult = [] const newResult = []
if (result.length) { if (result.length) {
for (let i = result.length - 1; i > -1; i--) { for (let i = result.length - 1; i > -1; i--) {