修复列表备份文件存在异常歌曲信息时无法导入的问题

pull/1123/head
lyswhut 2023-01-02 18:35:42 +08:00
parent 7e94e96bcc
commit 95590dd07f
4 changed files with 13 additions and 29 deletions

View File

@ -1,14 +1,4 @@
若你更新v2.0.0后,出现之前收藏的歌曲全部丢失或者歌曲无法添加到列表播放的问题,可以按以下方式解决:
1. 根据你的平台类型,进入软件数据目录
- Windows`%APPDATA%/lx-music-desktop`
- Linux`$XDG_CONFIG_HOME/lx-music-desktop` 或 `~/.config/lx-music-desktop`
- macOS`~/Library/Application Support/lx-music-desktop`
2. 进入`LxDatas`目录退出LX删除`lx.data.db`文件,再启动软件即可
若以上操作仍然不行可以加交流群或者在GitHub开issue反馈
### 修复
- 修复无效的歌曲信息导致我的列表数据迁移失败的问题
- 修复列表备份文件存在异常歌曲信息时无法导入的问题

View File

@ -118,3 +118,13 @@ export const fixNewMusicInfoQuality = (musicInfo: LX.Music.MusicInfo) => {
return musicInfo
}
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) || !s.name) return false
if (s.singer == null) s.singer = ''
ids.add(s.id)
return true
})
}

View File

@ -1,7 +1,7 @@
import fs from 'node:fs'
import { checkPath, joinPath } from '@common/utils/nodejs'
import { log } from '@common/utils'
import { toNewMusicInfo } from '@common/utils/tools'
import { filterMusicList, toNewMusicInfo } from '@common/utils/tools'
import { APP_EVENT_NAMES, STORE_NAMES } from '@common/constants'
/**
@ -28,15 +28,7 @@ interface OldUserListInfo {
locationUpdateTime?: number
list: any[]
}
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) || !s.name) return false
if (s.singer == null) s.singer = ''
ids.add(s.id)
return true
})
}
/**
* v2.0.0 list data
* @returns

View File

@ -60,14 +60,6 @@ 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())