Skip to content

Commit bccadcf

Browse files
committed
新增:直接播放QQ音乐排行榜音乐
1 parent 43bc2b6 commit bccadcf

21 files changed

Lines changed: 241 additions & 108 deletions

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/).
66
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
77
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
88

9+
## [0.1.1](https://github.com/lyswhut/lx-music-desktop/compare/v0.1.0...v0.1.1) - 2019-08-17
10+
11+
### 新增
12+
13+
- QQ音乐排行榜直接试听与下载(该接口貌似不太稳定,且用且珍惜!)
14+
15+
### 优化
16+
17+
- 优化http请求机制
18+
- 更新关于本软件说明
19+
20+
### 修复
21+
22+
- 修复当上一个歌曲链接正在获取时切换歌曲请求不会取消的问题
23+
- 修复切换歌曲时仍然播放上一首歌曲的问题
24+
925
## [0.1.0] - 2019-8-16
1026

1127
* 0.1.0版本发布

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lx-music-desktop",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "一个免费的音乐下载助手",
55
"main": "./dist/electron/main.js",
66
"scripts": {
@@ -75,6 +75,7 @@
7575
"babel-preset-minify": "^0.5.0",
7676
"cfonts": "^2.4.4",
7777
"chalk": "^2.4.2",
78+
"changelog-parser": "^2.8.0",
7879
"copy-webpack-plugin": "^5.0.4",
7980
"core-js": "^3.2.1",
8081
"cos-nodejs-sdk-v5": "^2.5.11",

publish/changeLog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
* 0.1.0版本发布
1+
### 新增
2+
3+
- QQ音乐排行榜直接试听与下载(该接口貌似不太稳定,且用且珍惜!)
4+
5+
### 优化
6+
7+
- 优化http请求机制
8+
- 更新关于本软件说明
9+
10+
### 修复
11+
12+
- 修复当上一个歌曲链接正在获取时切换歌曲请求不会取消的问题
13+
- 修复切换歌曲时仍然播放上一首歌曲的问题

publish/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ const fs = require('fs')
22
const path = require('path')
33
const chalk = require('chalk')
44
const clearAssets = require('./utils/clearAssets')
5-
const packAssets = require('./utils/packAssets')
6-
const compileAssets = require('./utils/compileAssets')
5+
// const packAssets = require('./utils/packAssets')
6+
// const compileAssets = require('./utils/compileAssets')
77
const updateVersionFile = require('./utils/updateChangeLog')
8-
const copyFile = require('./utils/copyFile')
9-
const githubRelease = require('./utils/githubRelease')
8+
// const copyFile = require('./utils/copyFile')
9+
// const githubRelease = require('./utils/githubRelease')
1010
const { parseArgv } = require('./utils')
1111

1212
const run = async() => {

publish/version.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"version": "0.1.0",
3-
"desc": "0.1.0版本发布",
4-
"history": []
2+
"version": "0.1.1",
3+
"desc": "<h3>新增</h3>\n<ul>\n<li>QQ音乐排行榜直接试听与下载(该接口貌似不太稳定,且用且珍惜!)</li>\n</ul>\n<h3>优化</h3>\n<ul>\n<li>优化http请求机制</li>\n<li>更新关于本软件说明</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复当上一个歌曲链接正在获取时切换歌曲请求不会取消的问题</li>\n<li>修复切换歌曲时仍然播放上一首歌曲的问题</li>\n</ul>\n",
4+
"history": [
5+
{
6+
"version": "0.1.0",
7+
"desc": "0.1.0版本发布"
8+
}
9+
]
510
}

src/renderer/components/core/Player.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ export default {
9898
watch: {
9999
changePlay(n) {
100100
if (!n) return
101+
// console.log('changePlay')
102+
this.handleRemoveMusic()
101103
this.resetChangePlay()
102104
if (this.playIndex < 0) return
103105
this.stopPlay()
@@ -112,7 +114,7 @@ export default {
112114
? n.findIndex(s => s.musicInfo.songmid === this.musicInfo.songmid)
113115
: n.findIndex(s => s.songmid === this.musicInfo.songmid)
114116
if (index < 0) {
115-
this.handleRemoveMusic()
117+
this.fixPlayIndex(this.playIndex - 1)
116118
if (n.length) this.handleNext()
117119
} else {
118120
this.fixPlayIndex(index)
@@ -362,7 +364,6 @@ export default {
362364
this.musicInfo.url = null
363365
this.nowPlayTime = 0
364366
this.maxPlayTime = 0
365-
this.fixPlayIndex(this.playIndex - 1)
366367
},
367368
sendProgressEvent(status, mode) {
368369
// console.log(status)

src/renderer/store/modules/download.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const getExt = type => {
4141
const checkList = (list, musicInfo, type) => list.some(s => s.musicInfo.songmid === musicInfo.songmid && s.type === type)
4242

4343
const refreshUrl = downloadInfo => {
44-
return music[downloadInfo.musicInfo.source].getMusicUrl(downloadInfo.musicInfo, downloadInfo.type)
44+
return music[downloadInfo.musicInfo.source].getMusicUrl(downloadInfo.musicInfo, downloadInfo.type).promise
4545
}
4646

4747
// actions

src/renderer/store/modules/player.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ const getters = {
1919
// actions
2020
const actions = {
2121
getUrl({ commit, state }, { musicInfo, type }) {
22-
return music[musicInfo.source].getMusicUrl(musicInfo, type).then(result => commit('setUrl', { musicInfo, url: result.url, type }))
22+
if (state.cancelFn) state.cancelFn()
23+
const { promise, cancelHttp } = music[musicInfo.source].getMusicUrl(musicInfo, type)
24+
state.cancelFn = cancelHttp
25+
return promise.then(result => {
26+
return commit('setUrl', { musicInfo, url: result.url, type })
27+
}).finally(() => {
28+
state.cancelFn = null
29+
})
2330
},
2431
getPic({ commit, state }, musicInfo) {
2532
return music[musicInfo.source].getPic(musicInfo).then(url => commit('getPic', { musicInfo, url }))

src/renderer/utils/music/kg/leaderboard.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ export default {
6868
limit: /pagesize: '(\d+)',/,
6969
listData: /global\.features = (\[.+\]);/,
7070
},
71-
_cancelIndex: null,
71+
_requestObj: null,
7272
_cancelPromiseCancelFn: null,
7373
getData(url) {
74-
if (this._cancelIndex != null) {
75-
cancelHttp(this._cancelIndex)
74+
if (this._requestObj != null) {
75+
cancelHttp(this._requestObj)
7676
this._cancelPromiseCancelFn(new Error('取消http请求'))
7777
}
7878
return new Promise((resolve, reject) => {
7979
this._cancelPromiseCancelFn = reject
80-
this._cancelIndex = httpGet(url, (err, resp, body) => {
81-
this._cancelIndex = null
80+
this._requestObj = httpGet(url, (err, resp, body) => {
81+
this._requestObj = null
8282
this._cancelPromiseCancelFn = null
8383
if (err) {
8484
console.log(err)

0 commit comments

Comments
 (0)