Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Nov 9, 2021
2 parents 379c752 + 25a0439 commit 1cf0f2d
Show file tree
Hide file tree
Showing 19 changed files with 1,805 additions and 2,598 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/).
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).

## [1.15.1](https://github.com/lyswhut/lx-music-desktop/compare/v1.15.0...v1.15.1) - 2021-11-09

### 优化

- 优化我的列表、下载列表等列表的滚动流畅度
- 优化下载功能的批量添加、删除、暂停任务时的流畅度,现在进行这些操作应该不会再觉得卡顿了
- 支持启动软件时恢复播放下载列表里的歌曲
- 添加媒体播放进度条的信息设置

### 修复

- 修复某些情况下获取URL失败时会意外切歌的问题
- 修复了某些情况下会列表同步失败,导致连接断开无限重连或一直卡在 `syncing...` 的问题
- 修复列表数据过大导致同步失败的问题

### 其他

- 更新electron到v15.3.1(这修复了媒体控制失效的问题)

## [1.15.0](https://github.com/lyswhut/lx-music-desktop/compare/v1.14.1...v1.15.0) - 2021-10-29

### 新增
Expand Down
4 changes: 3 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

播放在线列表内的歌曲需要将它们都添加到我的列表才能播放,你可以全选列表内的歌曲然后添加到现有列表或者新创建的列表,然后去播放该列表内的歌曲。

从v1.10.0起,你可以右击排行榜名字的弹出菜单中直接播放或收藏整个排行榜的歌曲。

## 无法打开外部歌单

不支持跨源打开歌单,请**确认**你需要打开的歌单平台是否与软件标签所写的**歌单源**对应(不一样的话请通过右上角切换歌单源);<br>
Expand Down Expand Up @@ -142,7 +144,7 @@

注:v1.6.0及之后的版本才支持`-dha`参数

## Window 7 下软件启动后,界面无法显示
## Windows 7 下软件启动后,界面无法显示

对于软件启动后,可以在任务栏看到软件,但软件界面在桌面上无任何显示,或者整个界面偶尔闪烁的情况。<br>
原始问题看:<https://github.com/electron/electron/issues/19569#issuecomment-522231083><br>
Expand Down
3,556 changes: 1,269 additions & 2,287 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lx-music-desktop",
"version": "1.15.0",
"version": "1.15.1",
"description": "一个免费的音乐查找助手",
"main": "./dist/electron/main.js",
"productName": "lx-music-desktop",
Expand Down Expand Up @@ -167,31 +167,31 @@
},
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
"devDependencies": {
"@babel/core": "^7.15.8",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-umd": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.15.8",
"@babel/plugin-transform-modules-umd": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.0",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.15.8",
"@babel/preset-env": "^7.16.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.3",
"babel-preset-minify": "^0.5.1",
"browserslist": "^4.17.5",
"browserslist": "^4.17.6",
"cfonts": "^2.10.0",
"chalk": "^4.1.2",
"changelog-parser": "^2.8.0",
"copy-webpack-plugin": "^9.0.1",
"core-js": "^3.19.0",
"core-js": "^3.19.1",
"cross-env": "^7.0.3",
"css-loader": "^6.5.0",
"css-minimizer-webpack-plugin": "^3.1.1",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.1.2",
"del": "^6.0.0",
"electron": "^15.3.0",
"electron": "^15.3.1",
"electron-builder": "^22.11.7",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.3.884",
"electron-to-chromium": "^1.3.891",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-formatter-friendly": "^7.0.0",
Expand All @@ -208,7 +208,7 @@
"less-loader": "^10.2.0",
"less-plugin-clean-css": "^1.5.1",
"markdown-it": "^12.2.0",
"mini-css-extract-plugin": "^2.4.3",
"mini-css-extract-plugin": "^2.4.4",
"node-loader": "^2.0.0",
"postcss": "^8.3.11",
"postcss-loader": "^6.2.0",
Expand All @@ -219,11 +219,11 @@
"raw-loader": "^4.0.2",
"rimraf": "^3.0.2",
"spinnies": "^0.5.1",
"terser-webpack-plugin": "^5.2.4",
"terser-webpack-plugin": "^5.2.5",
"url-loader": "^4.1.1",
"vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.14",
"webpack": "^5.60.0",
"webpack": "^5.62.1",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^3.11.2",
"webpack-hot-middleware": "^2.25.1",
Expand All @@ -240,14 +240,14 @@
"iconv-lite": "^0.6.3",
"image-size": "^1.0.0",
"koa": "^2.13.4",
"long": "^5.0.1",
"long": "^5.1.0",
"needle": "^3.0.0",
"node-id3": "^0.2.3",
"request": "^2.88.2",
"socket.io": "^4.3.1",
"socket.io": "^4.3.2",
"utf-8-validate": "^5.0.7",
"vue": "^2.6.14",
"vue-i18n": "^8.26.5",
"vue-i18n": "^8.26.7",
"vue-router": "^3.5.3",
"vuex": "^3.6.2"
}
Expand Down
22 changes: 8 additions & 14 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
### 新增

- 添加黑色托盘图标
- 自定义源新增`version`字段,新增`utils.buffer.bufToString`方法

### 优化

- 大幅优化我的列表、下载、歌单、排行榜列表性能,现在即使同一列表内的歌曲很多时也不会卡顿了
- 优化列表同步代码逻辑
- 优化开关评论时的动画性能
- 优化进入、离开播放详情页的性能
- 兼容桌面歌词以触摸的方式移动、调整大小
- 调整图标尺寸
- 优化我的列表、下载列表等列表的滚动流畅度
- 优化下载功能的批量添加、删除、暂停任务时的流畅度,现在进行这些操作应该不会再觉得卡顿了
- 支持启动软件时恢复播放下载列表里的歌曲
- 添加媒体播放进度条的信息设置

### 修复

- 修复kg源的歌单链接无法打开的问题
- 修复同一首歌的URL、歌词等同时需要换源时的处理问题
- 修复某些情况下获取URL失败时会意外切歌的问题
- 修复了某些情况下会列表同步失败,导致连接断开无限重连或一直卡在 `syncing...` 的问题
- 修复列表数据过大导致同步失败的问题

### 其他

- 更新 Electron 到 v15.3.0
- 更新electron到v15.3.1(这修复了媒体控制失效的问题)
2 changes: 1 addition & 1 deletion publish/version.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ exports.initSetting = isShowErrorAlert => {
// 迁移列表滚动位置设置 ~0.18.3
if (setting.list.scroll) {
let scroll = setting.list.scroll
// electronStore_list.set('defaultList.location', scroll.locations.default || 0)
// electronStore_list.set('loveList.location', scroll.locations.love || 0)
electronStore_config.delete('setting.list.scroll')
electronStore_config.set('setting.list.isSaveScrollLocation', scroll.enable)
delete setting.list.scroll
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const { isMac, isLinux, initHotKey } = require('../common/utils')
// https://github.com/electron/electron/issues/18397
// 开发模式下为true时 多次引入native模块会导致渲染进程卡死
// https://github.com/electron/electron/issues/22791
app.allowRendererProcessReuse = !isDev
// app.allowRendererProcessReuse = !isDev


app.on('web-contents-created', (event, contents) => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/modules/sync/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const handleStartServer = (port = 9527) => new Promise((resolve, reject) => {
serveClient: false,
connectTimeout: 10000,
pingTimeout: 30000,
maxHttpBufferSize: 3e6,
maxHttpBufferSize: 1e9, // 1G
allowRequest: authConnection,
transports: ['websocket'],
})
Expand Down
51 changes: 34 additions & 17 deletions src/main/modules/sync/server/syncList.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ let io
let syncingId = null
const wait = (time = 1000) => new Promise((resolve, reject) => setTimeout(resolve, time))

const patchListData = listData => {
return Object.assign({}, {
defaultList: {
id: 'default',
name: '试听列表',
list: [],
},
loveList: {
id: 'love',
name: '我的收藏',
list: [],
},
userList: [],
}, listData)
}

const getRemoteListData = socket => new Promise((resolve, reject) => {
console.log('getRemoteListData')
const handleError = reason => {
Expand All @@ -23,7 +39,7 @@ const getRemoteListData = socket => new Promise((resolve, reject) => {
const data = JSON.parse(decryptMsg(socket.data.keyInfo, enData))
if (!data) return reject(new Error('Get remote list data failed'))
if (data.action != 'getData') return
resolve(data.data)
resolve(patchListData(data.data))
}

socket.on('disconnect', handleError)
Expand All @@ -35,7 +51,7 @@ const getLocalListData = () => new Promise((resolve, reject) => {
const handleSuccess = ({ action, data }) => {
if (action !== 'getData') return
global.lx_event.sync.off(SYNC_EVENT_NAMES.sync_handle_list, handleSuccess)
resolve(data)
resolve(patchListData(data))
}
global.lx_event.sync.on(SYNC_EVENT_NAMES.sync_handle_list, handleSuccess)
global.lx_event.sync.sync_list({
Expand Down Expand Up @@ -87,10 +103,10 @@ const updateSnapshot = (path, data) => {
}


const createListDataObj = listData => {
const listDataObj = {}
for (const list of listData.userList) listDataObj[list.id] = list
return listDataObj
const createUserListDataObj = listData => {
const userListDataObj = {}
for (const list of listData.userList) userListDataObj[list.id] = list
return userListDataObj
}

const handleMergeList = (sourceList, targetList, addMusicLocationType) => {
Expand Down Expand Up @@ -137,11 +153,11 @@ const mergeList = (sourceListData, targetListData) => {
newListData.defaultList = handleMergeList(sourceListData.defaultList, targetListData.defaultList, addMusicLocationType)
newListData.loveList = handleMergeList(sourceListData.loveList, targetListData.loveList, addMusicLocationType)

const listDataObj = createListDataObj(sourceListData)
const userListDataObj = createUserListDataObj(sourceListData)
newListData.userList = [...sourceListData.userList]

for (const list of targetListData.userList) {
const targetList = listDataObj[list.id]
const targetList = userListDataObj[list.id]
if (targetList) {
targetList.list = handleMergeList(targetList, list, addMusicLocationType).list
} else {
Expand All @@ -156,11 +172,11 @@ const overwriteList = (sourceListData, targetListData) => {
newListData.defaultList = sourceListData.defaultList
newListData.loveList = sourceListData.loveList

const listDataObj = createListDataObj(sourceListData)
const userListDataObj = createUserListDataObj(sourceListData)
newListData.userList = [...sourceListData.userList]

for (const list of targetListData.userList) {
const targetList = listDataObj[list.id]
const targetList = userListDataObj[list.id]
if (targetList) continue
newListData.userList.push(list)
}
Expand Down Expand Up @@ -259,8 +275,10 @@ const mergeListDataFromSnapshot = (sourceList, targetList, snapshotList, addMusi
const targetListItemIds = new Set()
for (const m of sourceList.list) sourceListItemIds.add(m.songmid)
for (const m of targetList.list) targetListItemIds.add(m.songmid)
for (const m of snapshotList.list) {
if (!sourceListItemIds.has(m.songmid) || !targetListItemIds.has(m.songmid)) removedListIds.add(m.songmid)
if (snapshotList) {
for (const m of snapshotList.list) {
if (!sourceListItemIds.has(m.songmid) || !targetListItemIds.has(m.songmid)) removedListIds.add(m.songmid)
}
}

let newList
Expand Down Expand Up @@ -294,13 +312,12 @@ const mergeListDataFromSnapshot = (sourceList, targetList, snapshotList, addMusi
const handleMergeListDataFromSnapshot = async(socket, snapshot) => {
const addMusicLocationType = global.appSetting.list.addMusicLocationType
const [remoteListData, localListData] = await Promise.all([getRemoteListData(socket), getLocalListData()])
console.log('handleMergeListDataFromSnapshot', 'remoteListData, localListData')
const newListData = {}
newListData.defaultList = mergeListDataFromSnapshot(localListData.defaultList, remoteListData.defaultList, snapshot.defaultList, addMusicLocationType)
newListData.loveList = mergeListDataFromSnapshot(localListData.loveList, remoteListData.loveList, snapshot.loveList, addMusicLocationType)
const localUserListData = createListDataObj(localListData)
const remoteUserListData = createListDataObj(remoteListData)
const snapshotUserListData = createListDataObj(snapshot)
const localUserListData = createUserListDataObj(localListData)
const remoteUserListData = createUserListDataObj(remoteListData)
const snapshotUserListData = createUserListDataObj(snapshot)
const removedListIds = new Set()
const localUserListIds = new Set()
const remoteUserListIds = new Set()
Expand Down Expand Up @@ -367,7 +384,7 @@ const syncList = async socket => {
}
console.log('isSyncRequired', isSyncRequired)
if (isSyncRequired) return handleSyncList(socket)
return handleMergeListDataFromSnapshot(socket, fileData)
return handleMergeListDataFromSnapshot(socket, patchListData(fileData))
}

const checkSyncQueue = async() => {
Expand Down
26 changes: 19 additions & 7 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
},
downloadList: {
handler(n) {
this.saveDownloadList(n)
this.saveDownloadList(window.downloadListFull)
},
deep: true,
},
Expand Down Expand Up @@ -373,12 +373,17 @@ export default {
},
initDownloadList(downloadList) {
if (downloadList) {
downloadList.forEach(item => {
downloadList = downloadList.filter(item => item && item.key && item.musicInfo)
for (const item of downloadList) {
if (item.name == null) {
item.name = `${item.musicInfo.name} - ${item.musicInfo.singer}`
item.songmid = item.musicInfo.songmid
}
if (item.status == this.downloadStatus.RUN || item.status == this.downloadStatus.WAITING) {
item.status = this.downloadStatus.PAUSE
item.statusText = '暂停下载'
}
})
}
this.updateDownloadList(downloadList)
}
},
Expand All @@ -399,10 +404,17 @@ export default {
if (!info) return
if (info.index < 0) return
if (info.listId) {
const list = window.allList[info.listId]
// console.log(list)
if (!list || !list.list[info.index]) return
info.list = list.list
if (info.listId == 'download') {
const list = this.downloadList
// console.log(list)
if (!list || !list[info.index]) return
info.list = list
} else {
const list = window.allList[info.listId]
// console.log(list)
if (!list || !list.list[info.index]) return
info.list = list.list
}
}
if (!info.list || !info.list[info.index]) return
window.restorePlayInfo = info
Expand Down
Loading

0 comments on commit 1cf0f2d

Please sign in to comment.