新增下载的歌曲按列表名分组的功能(#2145)

This commit is contained in:
lyswhut
2024-12-14 12:48:19 +08:00
parent 63b2c2fb2f
commit 6f74003e14
20 changed files with 112 additions and 39 deletions
+4 -4
View File
@@ -1,4 +1,3 @@
import { appSetting } from '@renderer/store/setting'
import { getDownloadFilePath } from '@renderer/utils/music'
import {
@@ -7,6 +6,7 @@ import {
getLyricInfo as getOnlineLyricInfo,
} from './online'
import { buildLyricInfo, getCachedLyricInfo } from './utils'
import { buildSavePath } from '@renderer/store/download/utils'
export const getMusicUrl = async({ musicInfo, isRefresh, allowToggleSource = true, onToggleSource = () => {} }: {
musicInfo: LX.Download.ListItem
@@ -15,7 +15,7 @@ export const getMusicUrl = async({ musicInfo, isRefresh, allowToggleSource = tru
allowToggleSource?: boolean
}): Promise<string> => {
if (!isRefresh) {
const path = await getDownloadFilePath(musicInfo, appSetting['download.savePath'])
const path = await getDownloadFilePath(musicInfo, buildSavePath(musicInfo))
if (path) return path
}
@@ -29,7 +29,7 @@ export const getPicUrl = async({ musicInfo, isRefresh, listId, onToggleSource =
onToggleSource?: (musicInfo?: LX.Music.MusicInfoOnline) => void
}): Promise<string> => {
if (!isRefresh) {
const path = await getDownloadFilePath(musicInfo, appSetting['download.savePath'])
const path = await getDownloadFilePath(musicInfo, buildSavePath(musicInfo))
if (path) {
const pic = await window.lx.worker.main.getMusicFilePic(path)
if (pic) return pic
@@ -62,7 +62,7 @@ export const getLyricInfo = async({ musicInfo, isRefresh, onToggleSource = () =>
onToggleSource,
}).catch(async() => {
// 尝试读取文件内歌词
const path = await getDownloadFilePath(musicInfo, appSetting['download.savePath'])
const path = await getDownloadFilePath(musicInfo, buildSavePath(musicInfo))
if (path) {
const rawlrcInfo = await window.lx.worker.main.getMusicFileLyric(path)
if (rawlrcInfo) return buildLyricInfo(rawlrcInfo)
+1 -1
View File
@@ -29,7 +29,7 @@ export const filterList = async({ playedList, listId, list, playerMusicInfo, isN
listId,
list: list.map(m => toRaw(m)),
playedList: toRaw(playedList),
savePath: appSetting['download.savePath'],
// savePath: appSetting['download.savePath'],
playerMusicInfo: toRaw(playerMusicInfo),
dislikeInfo: { names: toRaw(dislikeInfo.names), musicNames: toRaw(dislikeInfo.musicNames), singerNames: toRaw(dislikeInfo.singerNames) },
isNext,