From 1786376a9e68b3a3faea481b469149c4eaa5263d Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 29 Aug 2019 13:41:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B7=E6=B1=82=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A0=E8=BD=BDbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ CHANGELOG.md | 10 ++++++++++ package.json | 2 +- publish/changeLog.md | 10 +++++----- publish/version.json | 8 ++++++-- src/renderer/components/core/Player.vue | 5 +++-- src/renderer/utils/music/kg/api-internal.js | 2 +- src/renderer/utils/music/kw/api-internal.js | 2 +- src/renderer/utils/music/kw/api-temp.js | 12 +++--------- src/renderer/utils/music/kw/index.js | 3 ++- src/renderer/utils/music/kw/pic.js | 9 +++++++++ src/renderer/utils/music/{messoer.js => options.js} | 2 +- src/renderer/utils/music/tx/api-internal.js | 2 +- src/renderer/utils/music/wy/api-internal.js | 2 +- src/renderer/utils/request.js | 2 +- src/renderer/views/Setting.vue | 2 +- 16 files changed, 48 insertions(+), 27 deletions(-) create mode 100644 src/renderer/utils/music/kw/pic.js rename src/renderer/utils/music/{messoer.js => options.js} (79%) diff --git a/.gitignore b/.gitignore index 2c55eb6c86..41dd8bdf81 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,5 @@ dist publish/assets publish/utils/githubToken.js + +src/**/*-internal.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dfcd1b286..b4f4b19305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ 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.3.4](https://github.com/lyswhut/lx-music-desktop/compare/v0.3.3...v0.3.4) - 2019-08-29 + +### 优化 + +- 减少接口不稳定带来的影响,适当增加请求等待时间 + +### 修复 + +- 修复播放过程中URL过期不会刷新URL的问题 + ## [0.3.3](https://github.com/lyswhut/lx-music-desktop/compare/v0.3.2...v0.3.3) - 2019-08-29 ### 修复 diff --git a/package.json b/package.json index 7ed07b49b8..61a5859605 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lx-music-desktop", - "version": "0.3.3", + "version": "0.3.4", "description": "一个免费的音乐下载助手", "main": "./dist/electron/main.js", "productName": "lx-music-desktop", diff --git a/publish/changeLog.md b/publish/changeLog.md index eb2dc4d3e1..748536170e 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,7 +1,7 @@ -### 修复 +### 优化 + +- 减少接口不稳定带来的影响,适当增加请求等待时间 -- **messoer**的接口已经关闭,暂时切换到临时接口使用,部分功能受限。。。 -- 修复设置界面更新出错时仍然显示更新下载中的问题 -- 修复手动定位播放进度条时存在偏差的问题 -- 屏蔽播放器中没有歌曲时对进度条的点击 +### 修复 +- 修复播放过程中URL过期不会刷新URL的问题 diff --git a/publish/version.json b/publish/version.json index 32ff4c97a7..e9986d9885 100644 --- a/publish/version.json +++ b/publish/version.json @@ -1,7 +1,11 @@ { - "version": "0.3.3", - "desc": "

修复

\n\n", + "version": "0.3.4", + "desc": "

优化

\n\n

修复

\n\n", "history": [ + { + "version": "0.3.3", + "desc": "

修复

\n\n" + }, { "version": "0.3.2", "desc": "

新增

\n\n" diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index 19387833e3..447297b4be 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -194,15 +194,16 @@ export default { // console.log('code', this.audio.error.code) if (!this.musicInfo.songmid) return console.log('出错') + this.stopPlay() + this.sendProgressEvent(this.progress, 'error') if (this.audio.error.code !== 1 && this.retryNum < 3) { // 若音频URL无效则尝试刷新3次URL // console.log(this.retryNum) this.audioErrorTime = this.audio.currentTime // 记录出错的播放时间 this.retryNum++ this.setUrl(this.list[this.playIndex], true) + this.status = 'URL过期,正在刷新URL...' return } - this.stopPlay() - this.sendProgressEvent(this.progress, 'error') // let urls = this.player_info.targetSong.urls // if (urls && urls.some((url, index) => { diff --git a/src/renderer/utils/music/kg/api-internal.js b/src/renderer/utils/music/kg/api-internal.js index 2fe074c719..fbdda9c935 100644 --- a/src/renderer/utils/music/kg/api-internal.js +++ b/src/renderer/utils/music/kg/api-internal.js @@ -1,6 +1,6 @@ import { httpFatch } from '../../request' import { requestMsg } from '../../message' -import { headers, timeout } from '../messoer' +import { headers, timeout } from '../options' const api_messoer = { getMusicUrl(songInfo, type) { diff --git a/src/renderer/utils/music/kw/api-internal.js b/src/renderer/utils/music/kw/api-internal.js index 6b22eb5922..1964ee7229 100644 --- a/src/renderer/utils/music/kw/api-internal.js +++ b/src/renderer/utils/music/kw/api-internal.js @@ -1,6 +1,6 @@ import { httpFatch } from '../../request' import { requestMsg } from '../../message' -import { headers, timeout } from '../messoer' +import { headers, timeout } from '../options' const api_messoer = { getMusicUrl(songInfo, type) { diff --git a/src/renderer/utils/music/kw/api-temp.js b/src/renderer/utils/music/kw/api-temp.js index 14ac6d9ac6..d29e3670d2 100644 --- a/src/renderer/utils/music/kw/api-temp.js +++ b/src/renderer/utils/music/kw/api-temp.js @@ -1,24 +1,18 @@ import { httpFatch } from '../../request' +import { headers, timeout } from '../options' const api_temp = { getMusicUrl(songInfo, type) { const requestObj = httpFatch(`http://45.32.53.128:3002/m/kw/u/${songInfo.songmid}/${type}`, { method: 'get', + headers, + timeout, }) requestObj.promise = requestObj.promise.then(({ body }) => { return body.code === 0 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(body.msg)) }) return requestObj }, - getPic(songInfo) { - const requestObj = httpFatch(`http://45.32.53.128:3002/m/kw/i/${songInfo.songmid}`, { - method: 'get', - }) - requestObj.promise = requestObj.promise.then(({ body }) => { - return body.code === 0 ? Promise.resolve(body.data) : Promise.reject(new Error(body.msg)) - }) - return requestObj - }, } export default api_temp diff --git a/src/renderer/utils/music/kw/index.js b/src/renderer/utils/music/kw/index.js index 9176328d5d..819894950b 100644 --- a/src/renderer/utils/music/kw/index.js +++ b/src/renderer/utils/music/kw/index.js @@ -4,6 +4,7 @@ import musicSearch from './musicSearch' import { formatSinger } from './util' import leaderboard from './leaderboard' import lyric from './lyric' +import pic from './pic' import api_source from '../api-source' const kw = { @@ -91,7 +92,7 @@ const kw = { }, getPic(songInfo) { - return api_source('kw').getPic(songInfo) + return pic.getPic(songInfo) }, } diff --git a/src/renderer/utils/music/kw/pic.js b/src/renderer/utils/music/kw/pic.js new file mode 100644 index 0000000000..08b2c241e3 --- /dev/null +++ b/src/renderer/utils/music/kw/pic.js @@ -0,0 +1,9 @@ +import { httpFatch } from '../../request' + +export default { + getPic({ songmid }) { + const requestObj = httpFatch(`http://artistpicserver.kuwo.cn/pic.web?corp=kuwo&type=rid_pic&pictype=500&size=500&rid=${songmid}`) + requestObj.promise = requestObj.promise.then(({ body }) => body) + return requestObj + }, +} diff --git a/src/renderer/utils/music/messoer.js b/src/renderer/utils/music/options.js similarity index 79% rename from src/renderer/utils/music/messoer.js rename to src/renderer/utils/music/options.js index 936b2964d5..c6ce350cd4 100644 --- a/src/renderer/utils/music/messoer.js +++ b/src/renderer/utils/music/options.js @@ -6,4 +6,4 @@ export const headers = { } -export const timeout = 10000 +export const timeout = 15000 diff --git a/src/renderer/utils/music/tx/api-internal.js b/src/renderer/utils/music/tx/api-internal.js index 06c7536f8d..dd984fd840 100644 --- a/src/renderer/utils/music/tx/api-internal.js +++ b/src/renderer/utils/music/tx/api-internal.js @@ -1,6 +1,6 @@ import { httpFatch } from '../../request' import { requestMsg } from '../../message' -import { headers, timeout } from '../messoer' +import { headers, timeout } from '../options' const api_messoer = { getMusicUrl(songInfo, type) { diff --git a/src/renderer/utils/music/wy/api-internal.js b/src/renderer/utils/music/wy/api-internal.js index 272cc26d51..d836e8101a 100644 --- a/src/renderer/utils/music/wy/api-internal.js +++ b/src/renderer/utils/music/wy/api-internal.js @@ -1,6 +1,6 @@ import { httpFatch } from '../../request' import { requestMsg } from '../../message' -import { headers, timeout } from '../messoer' +import { headers, timeout } from '../options' const api_messoer = { getMusicUrl(songInfo, type) { diff --git a/src/renderer/utils/request.js b/src/renderer/utils/request.js index ec34f11ab7..11093b3d75 100644 --- a/src/renderer/utils/request.js +++ b/src/renderer/utils/request.js @@ -2,7 +2,7 @@ import request from 'request' // import progress from 'request-progress' import { debugRequest } from './env' import { requestMsg } from './message' -import { bHh } from './music/messoer' +import { bHh } from './music/options' // import fs from 'fs' const headers = { diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue index ff078eef86..cb95dca1db 100644 --- a/src/renderer/views/Setting.vue +++ b/src/renderer/views/Setting.vue @@ -175,7 +175,7 @@ export default { // }, { id: 'temp', - label: '临时接口(软件的某些功能将不可用,但可下载无损等音质)', + label: '临时接口(软件的某些功能不可用,该接口访问速度较慢,请耐心等待)', disabled: false, }, ],