diff --git a/CHANGELOG.md b/CHANGELOG.md
index baac49b4..e6a8e92c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,21 @@ 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/).
+## [0.1.3](https://github.com/lyswhut/lx-music-desktop/compare/v0.1.2...v0.1.3) - 2019-08-17
+
+### 新增
+
+- 新增win32应用构建
+
+### 修复
+
+- 修复安装包许可协议乱码问题
+- **messoer 提供的接口已挂**,暂时切换到临时接口!
+
+### 移除
+
+- 由于messoer接口无法使用,QQ音乐排行榜直接播放/下载功能暂时关闭
+
## [0.1.2](https://github.com/lyswhut/lx-music-desktop/compare/v0.1.1...v0.1.2) - 2019-08-17
### 修复
diff --git a/package.json b/package.json
index ef7940da..29060350 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lx-music-desktop",
- "version": "0.1.2",
+ "version": "0.1.3",
"description": "一个免费的音乐下载助手",
"main": "./dist/electron/main.js",
"scripts": {
@@ -39,7 +39,10 @@
"legalTrademarks": "lyswhut",
"target": [
{
- "arch": ["ia32", "x64"],
+ "arch": [
+ "ia32",
+ "x64"
+ ],
"target": "nsis"
}
]
@@ -48,14 +51,21 @@
"target": [
{
"target": "AppImage",
- "arch": ["x64"]
+ "arch": [
+ "x64"
+ ]
},
{
- "arch": ["ia32", "x64"],
+ "arch": [
+ "ia32",
+ "x64"
+ ],
"target": "deb"
},
{
- "arch": ["x64"],
+ "arch": [
+ "x64"
+ ],
"target": "snap"
}
],
diff --git a/publish/changeLog.md b/publish/changeLog.md
index 145bf85f..e69de29b 100644
--- a/publish/changeLog.md
+++ b/publish/changeLog.md
@@ -1,3 +0,0 @@
-### 修复
-
-- 修复安装包许可协议乱码问题
diff --git a/publish/version.json b/publish/version.json
index 352e356b..7a8d641e 100644
--- a/publish/version.json
+++ b/publish/version.json
@@ -1,7 +1,11 @@
{
- "version": "0.1.2",
- "desc": "
修复
\n\n",
+ "version": "0.1.3",
+ "desc": "新增
\n\n修复
\n\n- 修复安装包许可协议乱码问题
\n- messoer 提供的接口已挂,暂时切换到临时接口!
\n
\n移除
\n\n- 由于messoer接口无法使用,QQ音乐排行榜直接播放/下载功能暂时关闭
\n
\n",
"history": [
+ {
+ "version": "0.1.2",
+ "desc": "修复
\n\n"
+ },
{
"version": "0.1.1",
"desc": "新增
\n\n- QQ音乐排行榜直接试听与下载(该接口貌似不太稳定,且用且珍惜!)
\n
\n优化
\n\n- 优化http请求机制
\n- 更新关于本软件说明
\n
\n修复
\n\n- 修复当上一个歌曲链接正在获取时切换歌曲请求不会取消的问题
\n- 修复切换歌曲时仍然播放上一首歌曲的问题
\n
\n"
diff --git a/src/renderer/store/modules/player.js b/src/renderer/store/modules/player.js
index bf1dcac5..d9b04a8e 100644
--- a/src/renderer/store/modules/player.js
+++ b/src/renderer/store/modules/player.js
@@ -8,6 +8,8 @@ const state = {
changePlay: false,
}
+let request
+
// getters
const getters = {
list: state => state.list || [],
@@ -19,13 +21,12 @@ const getters = {
// actions
const actions = {
getUrl({ commit, state }, { musicInfo, type }) {
- if (state.cancelFn) state.cancelFn()
- const { promise, cancelHttp } = music[musicInfo.source].getMusicUrl(musicInfo, type)
- state.cancelFn = cancelHttp
- return promise.then(result => {
- return commit('setUrl', { musicInfo, url: result.url, type })
+ if (request && request.cancelHttp) request.cancelHttp()
+ request = music[musicInfo.source].getMusicUrl(musicInfo, type)
+ return request.promise.then(result => {
+ commit('setUrl', { musicInfo, url: result.url, type })
}).finally(() => {
- state.cancelFn = null
+ request = null
})
},
getPic({ commit, state }, musicInfo) {
diff --git a/src/renderer/utils/music/kw/index.js b/src/renderer/utils/music/kw/index.js
index a58e51ee..d7c2bf6a 100644
--- a/src/renderer/utils/music/kw/index.js
+++ b/src/renderer/utils/music/kw/index.js
@@ -56,16 +56,18 @@ const kw = {
let cancelFn
const p = new Promise((resolve, reject) => {
cancelFn = reject
- requestObj = httpGet(`https://v1.itooi.cn/kuwo/url?id=${songInfo.songmid}&quality=${type.replace(/k$/, '')}&isRedirect=0`, (err, resp, body) => {
+ // requestObj = httpGet(`https://v1.itooi.cn/kuwo/url?id=${songInfo.songmid}&quality=${type.replace(/k$/, '')}&isRedirect=0`, (err, resp, body) => {
+ requestObj = httpGet(`https://www.stsky.cn/api/temp/getMusicUrl.php?id=${songInfo.songmid}&type=${type}`, (err, resp, body) => {
requestObj = null
cancelFn = null
if (err) {
- console.log(err)
+ if (err.message === 'socket hang up') return reject(new Error('接口挂了'))
const { promise, cancelHttp } = this.getMusicUrl(songInfo, type)
obj.cancelHttp = cancelHttp
return promise
}
- body.code === 200 ? resolve({ type, url: body.data }) : reject(new Error(body.msg))
+ // body.code === 200 ? resolve({ type, url: body.data }) : reject(new Error(body.msg))
+ body.code === 0 ? resolve({ type, url: body.data }) : reject(new Error(body.msg))
})
})
const obj = {
@@ -123,14 +125,16 @@ const kw = {
}
return new Promise((resolve, reject) => {
this._musicPicPromiseCancelFn = reject
- this._musicPicRequestObj = httpGet(`https://v1.itooi.cn/kuwo/pic?id=${songInfo.songmid}&isRedirect=0`, (err, resp, body) => {
+ // this._musicPicRequestObj = httpGet(`https://v1.itooi.cn/kuwo/pic?id=${songInfo.songmid}&isRedirect=0`, (err, resp, body) => {
+ this._musicPicRequestObj = httpGet(`https://www.stsky.cn/api/temp/getPic.php?size=320&songmid=${songInfo.songmid}`, (err, resp, body) => {
this._musicPicRequestObj = null
this._musicPicPromiseCancelFn = null
if (err) {
console.log(err)
reject(err)
}
- body.code === 200 ? resolve(body.data) : reject(new Error(body.msg))
+ // body.code === 200 ? resolve(body.data) : reject(new Error(body.msg))
+ body.code === 0 ? resolve(body.data) : reject(new Error(body.msg))
})
})
},
diff --git a/src/renderer/utils/music/kw/lyric.js b/src/renderer/utils/music/kw/lyric.js
index e806238d..8ba752c0 100644
--- a/src/renderer/utils/music/kw/lyric.js
+++ b/src/renderer/utils/music/kw/lyric.js
@@ -8,6 +8,9 @@ export default {
let s = (time % 60).toFixed(2)
return (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s)
},
+ transformLrc({ songinfo, lrclist }) {
+ return `[ti:${songinfo.songName}]\n[ar:${songinfo.artist}]\n[al:${songinfo.album}]\n[by:]\n[offset:0]\n${lrclist ? lrclist.map(l => `[${this.formatTime(l.time)}]${l.lineLyric}\n`).join('') : '暂无歌词'}`
+ },
getLyric(songId) {
if (this._musicLrcRequestObj != null) {
cancelHttp(this._musicLrcRequestObj)
@@ -15,16 +18,16 @@ export default {
}
return new Promise((resolve, reject) => {
this._musicLrcPromiseCancelFn = reject
- this._musicLrcRequestObj = httpGet(`https://v1.itooi.cn/kuwo/lrc?id=${songId}`, (err, resp, body) => {
+ // this._musicLrcRequestObj = httpGet(`https://v1.itooi.cn/kuwo/lrc?id=${songId}`, (err, resp, body) => {
+ this._musicLrcRequestObj = httpGet(`http://m.kuwo.cn/newh5/singles/songinfoandlrc?musicId=${songId}`, (err, resp, body) => {
this._musicLrcRequestObj = null
this._musicLrcPromiseCancelFn = null
if (err) {
console.log(err)
reject(err)
}
- // console.log(body.data)
- // console.log(this.transformLrc(body.data))
- resolve(body)
+ // resolve(body)
+ resolve(this.transformLrc(body.data))
})
})
},
diff --git a/src/renderer/utils/request.js b/src/renderer/utils/request.js
index 84d9a75e..69950151 100644
--- a/src/renderer/utils/request.js
+++ b/src/renderer/utils/request.js
@@ -3,16 +3,58 @@ import request from 'request'
import { debugRequest } from './env'
// import fs from 'fs'
-const fatchData = (url, method, options, callback) => request(url, {
- method,
- headers: options.headers,
- Origin: options.origin,
- data: options.data,
- json: options.format === undefined || options.format === 'json',
-}, (err, resp, body) => {
- if (err) return callback(err, null)
- callback(null, resp, body)
-})
+const fatchData = (url, method, options, callback) => {
+ console.log('---start---', url)
+ return request(url, {
+ method,
+ headers: options.headers,
+ Origin: options.origin,
+ data: options.data,
+ // timeout: 5000,
+ json: options.format === undefined || options.format === 'json',
+ }, (err, resp, body) => {
+ if (err) return callback(err, null)
+ console.log('---end---', url)
+ callback(null, resp, body)
+ })
+}
+
+export const httpFatch = (url, options = { method: 'get' }) => {
+ let requestObj
+ let cancelFn
+ const p = new Promise((resolve, reject) => {
+ cancelFn = reject
+ debugRequest && console.log(`\n---send request------${url}------------`)
+ requestObj = fatchData(url, options.method, options, (err, resp, body) => {
+ // options.isShowProgress && window.api.hideProgress()
+ debugRequest && console.log(`\n---response------${url}------------`)
+ debugRequest && console.log(JSON.stringify(body))
+ requestObj = null
+ cancelFn = null
+ if (err) {
+ console.log(err)
+ if (err.code === 'ETIMEDOUT') {
+ const { promise, cancelHttp } = httpFatch(url, options)
+ obj.cancelHttp = cancelHttp
+ return promise
+ }
+ }
+ resolve(resp)
+ })
+ })
+ const obj = {
+ promise: p,
+ cancelHttp() {
+ console.log('cancel')
+ if (!requestObj) return
+ cancelHttp(requestObj)
+ cancelFn(new Error('取消http请求'))
+ requestObj = null
+ cancelFn = null
+ },
+ }
+ return obj
+}
/**
* 取消请求
diff --git a/src/renderer/views/Leaderboard.vue b/src/renderer/views/Leaderboard.vue
index 6b6c7f3f..2690df87 100644
--- a/src/renderer/views/Leaderboard.vue
+++ b/src/renderer/views/Leaderboard.vue
@@ -25,7 +25,7 @@
td.break(style="width: 20%;") {{item.singer}}
td.break(style="width: 25%;") {{item.albumName}}
td(style="width: 18%;")
- material-list-buttons(:index="index" :search-btn="true" :play-btn="item.source == 'kw' || item.source == 'tx'" :download-btn="item.source == 'kw' || item.source == 'tx'" :remove-btn="false" @btn-click="handleBtnClick")
+ material-list-buttons(:index="index" :search-btn="true" :play-btn="item.source == 'kw'" :download-btn="item.source == 'kw'" :remove-btn="false" @btn-click="handleBtnClick")
//- button.btn-info(type='button' v-if="item._types['128k'] || item._types['192k'] || item._types['320k'] || item._types.flac" @click.stop='openDownloadModal(index)') 下载
//- button.btn-secondary(type='button' v-if="item._types['128k'] || item._types['192k'] || item._types['320k']" @click.stop='testPlay(index)') 试听
//- button.btn-success(type='button' v-if="(item._types['128k'] || item._types['192k'] || item._types['320k']) && userInfo" @click.stop='showListModal(index)') +
@@ -94,7 +94,7 @@ export default {
this.clickIndex = index
return
}
- (this.source == 'kw' || this.source == 'tx') ? this.testPlay(index) : this.handleSearch(index)
+ (this.source == 'kw') ? this.testPlay(index) : this.handleSearch(index)
this.clickTime = 0
this.clickIndex = -1
},