优化请求,修复加载bug

pull/96/head v0.3.4
lyswhut 2019-08-29 13:41:44 +08:00
parent aa973ea984
commit 1786376a9e
16 changed files with 48 additions and 27 deletions

2
.gitignore vendored
View File

@ -69,3 +69,5 @@ dist
publish/assets
publish/utils/githubToken.js
src/**/*-internal.js

View File

@ -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
### 修复

View File

@ -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",

View File

@ -1,7 +1,7 @@
### 优化
- 减少接口不稳定带来的影响,适当增加请求等待时间
### 修复
- **messoer**的接口已经关闭,暂时切换到临时接口使用,部分功能受限。。。
- 修复设置界面更新出错时仍然显示更新下载中的问题
- 修复手动定位播放进度条时存在偏差的问题
- 屏蔽播放器中没有歌曲时对进度条的点击
- 修复播放过程中URL过期不会刷新URL的问题

View File

@ -1,7 +1,11 @@
{
"version": "0.3.3",
"desc": "<h3>修复</h3>\n<ul>\n<li><strong>messoer</strong>的接口已经关闭,暂时切换到临时接口使用,部分功能受限。。。</li>\n<li>修复设置界面更新出错时仍然显示更新下载中的问题</li>\n<li>修复手动定位播放进度条时存在偏差的问题</li>\n<li>屏蔽播放器中没有歌曲时对进度条的点击</li>\n</ul>\n",
"version": "0.3.4",
"desc": "<h3>优化</h3>\n<ul>\n<li>减少接口不稳定带来的影响,适当增加请求等待时间</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复播放过程中URL过期不会刷新URL的问题</li>\n</ul>\n",
"history": [
{
"version": "0.3.3",
"desc": "<h3>修复</h3>\n<ul>\n<li><strong>messoer</strong>的接口已经关闭,暂时切换到临时接口使用,部分功能受限。。。</li>\n<li>修复设置界面更新出错时仍然显示更新下载中的问题</li>\n<li>修复手动定位播放进度条时存在偏差的问题</li>\n<li>屏蔽播放器中没有歌曲时对进度条的点击</li>\n</ul>\n"
},
{
"version": "0.3.2",
"desc": "<h3>新增</h3>\n<ul>\n<li>新增酷狗排行榜其他音质下载</li>\n</ul>\n"

View File

@ -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) { // URL3URL
// 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) => {

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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)
},
}

View File

@ -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
},
}

View File

@ -6,4 +6,4 @@ export const headers = {
}
export const timeout = 10000
export const timeout = 15000

View File

@ -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) {

View File

@ -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) {

View File

@ -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 = {

View File

@ -175,7 +175,7 @@ export default {
// },
{
id: 'temp',
label: '临时接口(软件的某些功能将不可用,但可下载无损等音质',
label: '临时接口(软件的某些功能不可用,该接口访问速度较慢,请耐心等待',
disabled: false,
},
],