Skip to content

Commit

Permalink
不再缓存换源歌曲信息
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Oct 17, 2024
1 parent 489bbb6 commit c1c0311
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
- 修复歌单详情页内歌单名字过长时的UI显示问题(#2028
- 修复获取自定义环境音效预设列表逻辑问题

### 变更

- 不再缓存换源歌曲信息

### 其他

- 更新 electron 到 v30.5.1
14 changes: 7 additions & 7 deletions src/renderer/core/music/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { qualityList } from '@renderer/store'
import { assertApiSupport } from '@renderer/store/utils'
import musicSdk from '@renderer/utils/musicSdk'
import {
getOtherSource as getOtherSourceFromStore,
saveOtherSource as saveOtherSourceFromStore,
// getOtherSource as getOtherSourceFromStore,
// saveOtherSource as saveOtherSourceFromStore,
getMusicUrl as getStoreMusicUrl,
getPlayerLyric as getStoreLyric,
} from '@renderer/utils/ipc'
Expand All @@ -17,10 +17,10 @@ const getOtherSourcePromises = new Map()
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[]> => {
if (!isRefresh && musicInfo.id) {
const cachedInfo = await getOtherSourceFromStore(musicInfo.id)
if (cachedInfo.length) return cachedInfo
}
// if (!isRefresh && musicInfo.id) {
// const cachedInfo = await getOtherSourceFromStore(musicInfo.id)
// if (cachedInfo.length) return cachedInfo
// }
let key: string
let searchMusicInfo: {
name: string
Expand Down Expand Up @@ -61,7 +61,7 @@ export const getOtherSource = async(musicInfo: LX.Music.MusicInfo | LX.Download.
if (timeout) clearTimeout(timeout)
})
}).then((otherSource) => {
if (otherSource.length) void saveOtherSourceFromStore(musicInfo.id, otherSource)
// if (otherSource.length) void saveOtherSourceFromStore(musicInfo.id, otherSource)
return otherSource
}).finally(() => {
if (getOtherSourcePromises.has(key)) getOtherSourcePromises.delete(key)
Expand Down

0 comments on commit c1c0311

Please sign in to comment.