mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
2571ebcbd1
13177
package-lock.json
generated
13177
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -2,3 +2,11 @@
|
|||||||
|
|
||||||
- 首次使用的提示窗口可以点击背景或者返回键关闭(#577)
|
- 首次使用的提示窗口可以点击背景或者返回键关闭(#577)
|
||||||
- 上移 Toast 位置避免遮挡播放模式图标(#603 @sibojia)
|
- 上移 Toast 位置避免遮挡播放模式图标(#603 @sibojia)
|
||||||
|
|
||||||
|
### 变更
|
||||||
|
|
||||||
|
- 不再缓存换源歌曲信息
|
||||||
|
|
||||||
|
### 其他
|
||||||
|
|
||||||
|
react-native → 0.73.10
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import musicSdk, { findMusic } from '@/utils/musicSdk'
|
import musicSdk, { findMusic } from '@/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 '@/utils/data'
|
} from '@/utils/data'
|
||||||
@ -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) {
|
// if (!isRefresh) {
|
||||||
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) BackgroundTimer.clearTimeout(timeout)
|
if (timeout) BackgroundTimer.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)
|
||||||
@ -208,17 +208,19 @@ export const getOnlineOtherSourcePicByLocal = async (musicInfo: LX.Music.MusicIn
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// export const getPlayQuality = (highQuality: boolean, musicInfo: LX.Music.MusicInfoOnline): LX.Quality => {
|
export const TRY_QUALITYS_LIST = ['flac24bit', 'flac', '320k'] as const
|
||||||
// let type: LX.Quality = '128k'
|
type TryQualityType = typeof TRY_QUALITYS_LIST[number]
|
||||||
// let list = global.lx.qualityList[musicInfo.source]
|
export const getPlayQuality = (highQuality: LX.Quality, musicInfo: LX.Music.MusicInfoOnline): LX.Quality => {
|
||||||
// if (highQuality && musicInfo.meta._qualitys['flac'] && list && list.includes('flac')) type = 'flac'
|
|
||||||
// return type
|
|
||||||
// }
|
|
||||||
|
|
||||||
export const getPlayQuality = (playQuality: LX.Quality, musicInfo: LX.Music.MusicInfoOnline): LX.Quality => {
|
|
||||||
let type: LX.Quality = '128k'
|
let type: LX.Quality = '128k'
|
||||||
|
if (TRY_QUALITYS_LIST.includes(highQuality as TryQualityType)) {
|
||||||
let list = global.lx.qualityList[musicInfo.source]
|
let list = global.lx.qualityList[musicInfo.source]
|
||||||
if (musicInfo.meta._qualitys[playQuality] && list && list.includes(playQuality)) type = playQuality
|
|
||||||
|
let t = TRY_QUALITYS_LIST
|
||||||
|
.slice(TRY_QUALITYS_LIST.indexOf(highQuality as TryQualityType))
|
||||||
|
.find(q => musicInfo.meta._qualitys[q] && list?.includes(q))
|
||||||
|
|
||||||
|
if (t) type = t
|
||||||
|
}
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +245,6 @@ export const getOnlineOtherSourceMusicUrl = async ({ musicInfos, quality, onTogg
|
|||||||
if (retryedSource.includes(musicInfo.source)) continue
|
if (retryedSource.includes(musicInfo.source)) continue
|
||||||
retryedSource.push(musicInfo.source)
|
retryedSource.push(musicInfo.source)
|
||||||
if (!assertApiSupport(musicInfo.source)) continue
|
if (!assertApiSupport(musicInfo.source)) continue
|
||||||
// itemQuality = quality ?? getPlayQuality(settingState.setting['player.isPlayHighQuality'], musicInfo)
|
|
||||||
itemQuality = quality ?? getPlayQuality(settingState.setting['player.playQuality'], musicInfo)
|
itemQuality = quality ?? getPlayQuality(settingState.setting['player.playQuality'], musicInfo)
|
||||||
if (!musicInfo.meta._qualitys[itemQuality]) continue
|
if (!musicInfo.meta._qualitys[itemQuality]) continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user