不再缓存换源歌曲信息

pull/2086/head
lyswhut 2024-10-17 12:36:59 +08:00
parent 489bbb6902
commit c1c0311586
2 changed files with 11 additions and 7 deletions

View File

@ -15,6 +15,10 @@
- 修复歌单详情页内歌单名字过长时的UI显示问题#2028 - 修复歌单详情页内歌单名字过长时的UI显示问题#2028
- 修复获取自定义环境音效预设列表逻辑问题 - 修复获取自定义环境音效预设列表逻辑问题
### 变更
- 不再缓存换源歌曲信息
### 其他 ### 其他
- 更新 electron 到 v30.5.1 - 更新 electron 到 v30.5.1

View File

@ -2,8 +2,8 @@ import { qualityList } from '@renderer/store'
import { assertApiSupport } from '@renderer/store/utils' import { assertApiSupport } from '@renderer/store/utils'
import musicSdk from '@renderer/utils/musicSdk' import musicSdk from '@renderer/utils/musicSdk'
import { import {
getOtherSource as getOtherSourceFromStore, // getOtherSource as getOtherSourceFromStore,
saveOtherSource as saveOtherSourceFromStore, // saveOtherSource as saveOtherSourceFromStore,
getMusicUrl as getStoreMusicUrl, getMusicUrl as getStoreMusicUrl,
getPlayerLyric as getStoreLyric, getPlayerLyric as getStoreLyric,
} from '@renderer/utils/ipc' } from '@renderer/utils/ipc'
@ -17,10 +17,10 @@ const getOtherSourcePromises = new Map()
export const existTimeExp = /\[\d{1,2}:.*\d{1,4}\]/ export const existTimeExp = /\[\d{1,2}:.*\d{1,4}\]/
export const getOtherSource = async(musicInfo: LX.Music.MusicInfo | LX.Download.ListItem, isRefresh = false): Promise<LX.Music.MusicInfoOnline[]> => { export const getOtherSource = async(musicInfo: LX.Music.MusicInfo | LX.Download.ListItem, isRefresh = false): Promise<LX.Music.MusicInfoOnline[]> => {
if (!isRefresh && musicInfo.id) { // if (!isRefresh && musicInfo.id) {
const cachedInfo = await getOtherSourceFromStore(musicInfo.id) // const cachedInfo = await getOtherSourceFromStore(musicInfo.id)
if (cachedInfo.length) return cachedInfo // if (cachedInfo.length) return cachedInfo
} // }
let key: string let key: string
let searchMusicInfo: { let searchMusicInfo: {
name: string name: string
@ -61,7 +61,7 @@ export const getOtherSource = async(musicInfo: LX.Music.MusicInfo | LX.Download.
if (timeout) clearTimeout(timeout) if (timeout) clearTimeout(timeout)
}) })
}).then((otherSource) => { }).then((otherSource) => {
if (otherSource.length) void saveOtherSourceFromStore(musicInfo.id, otherSource) // if (otherSource.length) void saveOtherSourceFromStore(musicInfo.id, otherSource)
return otherSource return otherSource
}).finally(() => { }).finally(() => {
if (getOtherSourcePromises.has(key)) getOtherSourcePromises.delete(key) if (getOtherSourcePromises.has(key)) getOtherSourcePromises.delete(key)