diff --git a/publish/changeLog.md b/publish/changeLog.md index e0873a68..d415c093 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -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反馈 ### 修复 -- 修复无效的歌曲信息导致我的列表数据迁移失败的问题 +- 修复列表备份文件存在异常歌曲信息时无法导入的问题 diff --git a/src/common/utils/tools.ts b/src/common/utils/tools.ts index 24f11eea..7dbbf3ae 100644 --- a/src/common/utils/tools.ts +++ b/src/common/utils/tools.ts @@ -118,3 +118,13 @@ export const fixNewMusicInfoQuality = (musicInfo: LX.Music.MusicInfo) => { return musicInfo } + +export const filterMusicList = (list: T[]): T[] => { + const ids: Set = 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 + }) +} diff --git a/src/main/utils/migrate.ts b/src/main/utils/migrate.ts index b9919ad3..de27ff5f 100644 --- a/src/main/utils/migrate.ts +++ b/src/main/utils/migrate.ts @@ -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 = (list: T[]): T[] => { - const ids: Set = 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 diff --git a/src/renderer/utils/index.ts b/src/renderer/utils/index.ts index c25bb653..91bdb641 100644 --- a/src/renderer/utils/index.ts +++ b/src/renderer/utils/index.ts @@ -60,14 +60,6 @@ export const deduplicationList = (list: T[]): T[] return true }) } -export const filterMusicList = (list: T[]): T[] => { - const ids: Set = 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())