导入备份时过滤歌曲

This commit is contained in:
lyswhut
2022-12-30 13:24:37 +08:00
parent c16de232ad
commit 18b6f73008
4 changed files with 29 additions and 12 deletions
+8
View File
@@ -60,6 +60,14 @@ export const deduplicationList = <T extends LX.Music.MusicInfo>(list: T[]): T[]
return true
})
}
export const filterMusicList = <T extends LX.Music.MusicInfo>(list: T[]): T[] => {
const ids: Set<string> = new Set()
return list.filter(s => {
if (!s.id || ids.has(s.id)) return false
ids.add(s.id)
return true
})
}
export const langS2T = async(str: string) => {
return await window.lx.worker.main.langS2t(Buffer.from(str).toString('base64')).then(b64 => Buffer.from(b64, 'base64').toString())