parent
214745ae87
commit
6e07719c2c
15
CHANGELOG.md
15
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
|
||||
|
||||
### 修复
|
||||
|
|
20
package.json
20
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"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
### 修复
|
||||
|
||||
- 修复安装包许可协议乱码问题
|
|
@ -1,7 +1,11 @@
|
|||
{
|
||||
"version": "0.1.2",
|
||||
"desc": "<h3>修复</h3>\n<ul>\n<li>修复更新弹窗的内容显示问题</li>\n</ul>\n",
|
||||
"version": "0.1.3",
|
||||
"desc": "<h3>新增</h3>\n<ul>\n<li>新增win32应用构建</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复安装包许可协议乱码问题</li>\n<li><strong>messoer 提供的接口已挂</strong>,暂时切换到临时接口!</li>\n</ul>\n<h3>移除</h3>\n<ul>\n<li>由于messoer接口无法使用,QQ音乐排行榜直接播放/下载功能暂时关闭</li>\n</ul>\n",
|
||||
"history": [
|
||||
{
|
||||
"version": "0.1.2",
|
||||
"desc": "<h3>修复</h3>\n<ul>\n<li>修复更新弹窗的内容显示问题</li>\n</ul>\n"
|
||||
},
|
||||
{
|
||||
"version": "0.1.1",
|
||||
"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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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))
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
|
@ -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))
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消请求
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue