Compare commits

...

7 Commits

Author SHA1 Message Date
lyswhut
9858170e61 发布0.2.2版本 2019-08-21 22:52:34 +08:00
lyswhut
16711e33e8 更新描述文本 2019-08-21 20:07:40 +08:00
lyswhut
f534e11acb 修复下载过程中出错重试5次都失败后不会自动开始下一个任务的Bug 2019-08-21 13:18:59 +08:00
lyswhut
2ff0f4b102 发布0.2.1版本 2019-08-20 21:28:06 +08:00
lyswhut
5b2a44e3bd 添加发布页面链接 2019-08-20 17:24:02 +08:00
lyswhut
0b06206d34 优化readme中的图片 2019-08-20 17:12:23 +08:00
lyswhut
cb93dfa218 完善readme 2019-08-20 16:57:43 +08:00
12 changed files with 136 additions and 59 deletions

View File

@@ -6,6 +6,24 @@ 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.2.2](https://github.com/lyswhut/lx-music-desktop/compare/v0.2.1...v0.2.2) - 2019-08-21
### 修复
- 修复下载过程中出错重试5次都失败后不会自动开始下一个任务的Bug
- 修复播放到一半URL过期时不会刷新URL直接播放下一首的问题
## [0.2.1](https://github.com/lyswhut/lx-music-desktop/compare/v0.2.0...v0.2.1) - 2019-08-20
### 优化
- 新增歌曲URL存储当URL无效时才重新获取以减少接口不稳定的影响
### 修复
- 修复歌曲加载无法加载时自动切换混乱的Bug
- 修复移除列表最后一首歌曲时播放器不停止播放的问题
## [0.2.0](https://github.com/lyswhut/lx-music-desktop/compare/v0.1.6...v0.2.0) - 2019-08-20
### 新增

View File

@@ -1,24 +1,34 @@
# 洛雪音乐助手桌面版
<p align="center"><a href="https://github.com/lyswhut/lx-music-desktop"><img width="200" src="https://github.com/lyswhut/lx-music-desktop/blob/master/doc/images/icon.png" alt="lx-music logo"></a></p>
[![GitHub release][1]][2]
<p align="center">
<a href="https://github.com/lyswhut/lx-music-desktop/releases"><img src="https://img.shields.io/github/release/lyswhut/lx-music-desktop" alt="Release version"></a>
<a href="https://ci.appveyor.com/project/lyswhut/lx-music-desktop"><img src="https://ci.appveyor.com/api/projects/status/flrsqd5ymp8fnte5?svg=true" alt="Build status"></a>
<a href="https://github.com/lyswhut/lx-music-desktop/releases"><img src="https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/latest/total" alt="Downloads"></a>
<a href="https://github.com/lyswhut/lx-music-desktop/tree/dev"><img src="https://img.shields.io/github/package-json/v/lyswhut/lx-music-desktop/dev" alt="Dev branch version"></a>
<!-- <a href="https://github.com/lyswhut/lx-music-desktop/blob/master/LICENSE"><img src="https://img.shields.io/github/license/lyswhut/lx-music-desktop" alt="License"></a> -->
</p>
<!-- [![GitHub release][1]][2]
[![Build status][3]][4]
[![GitHub Releases Download][5]][6]
[![dev branch][7]][8]
<!-- [![GitHub license][9]][10] -->
[![GitHub license][9]][10] -->
[1]: https://img.shields.io/github/release/lyswhut/lx-music-desktop
<!-- [1]: https://img.shields.io/github/release/lyswhut/lx-music-desktop
[2]: https://github.com/lyswhut/lx-music-desktop/releases
[3]: https://ci.appveyor.com/api/projects/status/flrsqd5ymp8fnte5?svg=true
[4]: https://ci.appveyor.com/project/lyswhut/lx-music-desktop
[5]: https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/latest/total
<!-- [5]: https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/total -->
[5]: https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/total
[6]: https://github.com/lyswhut/lx-music-desktop/releases
[7]: https://img.shields.io/github/package-json/v/lyswhut/lx-music-desktop/dev
[8]: https://github.com/lyswhut/lx-music-desktop/tree/dev
[9]: https://img.shields.io/github/license/lyswhut/lx-music-desktop
<!-- [10]: https://github.com/lyswhut/lx-music-desktop/blob/master/LICENSE -->
[10]: https://github.com/lyswhut/lx-music-desktop/blob/master/LICENSE -->
## 说明
<h2 align="center">洛雪音乐助手桌面版</h2>
### 说明
一个基于 Electron + Vue 开发的 Windows 版音乐软件。
@@ -27,13 +37,20 @@
- Electron 6.x
- Vue 2.x
软件变化请查看:[更新日志](https://github.com/lyswhut/lx-music-desktop/blob/master/CHANGELOG.md)<br>
软件下载请转到:[发布页面](https://github.com/lyswhut/lx-music-desktop/releases)
其他说明TODO
软件变化请查看:[更新日志](https://github.com/lyswhut/lx-music-desktop/blob/master/CHANGELOG.md)
#### 关于软件更新
感谢 <https://github.com/messoer> 提供的部分音乐API
软件启动时若发现新版本时会自动从本仓库下载安装包,下载完毕会弹窗提示更新。<br>
若下载未完成时软件被关闭,下次启动软件会再次自动下载。<br>
目前暂未添加跳过更新某个版本的功能。<br>
## 使用方法
### 源码使用方法
环境要求Node.js 12.x
```bash
# 开发模式
@@ -47,6 +64,14 @@ npm run pack
```
## License
### UI界面
Apache License 2.0
<p><a href="https://github.com/lyswhut/lx-music-desktop"><img width="100%" src="https://github.com/lyswhut/lx-music-desktop/blob/master/doc/images/app.png" alt="lx-music UI"></a></p>
### 致谢
感谢 [@messoer](https://github.com/messoer) 提供的部分音乐API
### 许可证
[Apache License 2.0](https://github.com/lyswhut/lx-music-desktop/blob/master/LICENSE)

BIN
doc/images/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
doc/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,6 +1,6 @@
{
"name": "lx-music-desktop",
"version": "0.2.0",
"version": "0.2.2",
"description": "一个免费的音乐下载助手",
"main": "./dist/electron/main.js",
"scripts": {

View File

@@ -1,10 +1,4 @@
### 新增
- 新增**百度音乐**排行榜及其音乐直接试听与下载
- 新增网易云排行榜音乐直接试听与下载目前仅支持128k音质
- 新增酷狗排行榜音乐直接试听与下载目前仅支持128k音质
### 修复
- 修复更新弹窗历史版本描述多余的换行问题
- 修复歌曲无法播放的情况下歌词仍会播放的问题
- 修复下载过程中出错重试5次都失败后不会自动开始下一个任务的Bug
- 修复播放到一半URL过期时不会刷新URL直接播放下一首的问题

View File

@@ -1,7 +1,15 @@
{
"version": "0.2.0",
"desc": "<h3>新增</h3>\n<ul>\n<li>新增<strong>百度音乐</strong>排行榜及其音乐直接试听与下载</li>\n<li>新增网易云排行榜音乐直接试听与下载目前仅支持128k音质</li>\n<li>新增酷狗排行榜音乐直接试听与下载目前仅支持128k音质</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复更新弹窗历史版本描述多余的换行问题</li>\n<li>修复歌曲无法播放的情况下歌词仍会播放的问题</li>\n</ul>\n",
"version": "0.2.2",
"desc": "<h3>修复</h3>\n<ul>\n<li>修复下载过程中出错重试5次都失败后不会自动开始下一个任务的Bug</li>\n<li>修复播放到一半URL过期时不会刷新URL直接播放下一首的问题</li>\n</ul>\n",
"history": [
{
"version": "0.2.1",
"desc": "<h3>优化</h3>\n<ul>\n<li>新增歌曲URL存储当URL无效时才重新获取以减少接口不稳定的影响</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复歌曲加载无法加载时自动切换混乱的Bug</li>\n<li>修复移除列表最后一首歌曲时播放器不停止播放的问题</li>\n</ul>\n"
},
{
"version": "0.2.0",
"desc": "<h3>新增</h3>\n<ul>\n<li>新增<strong>百度音乐</strong>排行榜及其音乐直接试听与下载</li>\n<li>新增网易云排行榜音乐直接试听与下载目前仅支持128k音质</li>\n<li>新增酷狗排行榜音乐直接试听与下载目前仅支持128k音质</li>\n</ul>\n<h3>修复</h3>\n<ul>\n<li>修复更新弹窗历史版本描述多余的换行问题</li>\n<li>修复歌曲无法播放的情况下歌词仍会播放的问题</li>\n</ul>\n"
},
{
"version": "0.1.6",
"desc": "<h3>修复</h3>\n<ul>\n<li>修复列表多选音源限制Bug</li>\n</ul>\n"

View File

@@ -53,6 +53,7 @@ export default {
},
defaultList: {
handler(n) {
// console.log(n)
this.electronStore.set('list.defaultList', n)
},
deep: true,
@@ -110,10 +111,11 @@ export default {
},
initPlayList() {
let defaultList = this.electronStore.get('list.defaultList')
// console.log(defaultList)
if (defaultList) {
defaultList.list.forEach(m => {
m.typeUrl = {}
})
// defaultList.list.forEach(m => {
// m.typeUrl = {}
// })
this.initDefaultList(defaultList)
}
},

View File

@@ -43,6 +43,7 @@ import Lyric from 'lrc-file-parser'
import { rendererSend } from '../../../common/icp'
import { formatPlayTime2, getRandom, checkPath } from '../../utils'
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { requestMsg } from '../../utils/message'
export default {
data() {
@@ -68,7 +69,9 @@ export default {
text: '',
line: 0,
},
retryNum: 0,
delayNextTimeout: null,
audioErrorTime: 0,
// retryNum: 0,
}
},
computed: {
@@ -119,8 +122,13 @@ export default {
? n.findIndex(s => s.musicInfo.songmid === this.musicInfo.songmid)
: n.findIndex(s => s.songmid === this.musicInfo.songmid)
if (index < 0) {
this.fixPlayIndex(this.playIndex - 1)
if (n.length) this.handleNext()
// console.log(this.playIndex)
if (n.length) {
this.fixPlayIndex(this.playIndex - 1)
this.handleNext()
} else {
this.setPlayIndex(-1)
}
} else {
this.fixPlayIndex(index)
}
@@ -167,8 +175,9 @@ export default {
// console.log('code', this.audio.error.code)
if (!this.musicInfo.songmid) return
console.log('出错')
if (this.audio.error.code == 4 && this.retryNum < 5) {
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)
return
@@ -191,13 +200,15 @@ export default {
// } else {
// this.handleNext()
// }
this.status = '音频加载出错,2 两秒后切换下一首'
setTimeout(() => {
this.handleNext()
}, 2000)
this.status = '音频加载出错,5 秒后切换下一首'
this.addDelayNextTimeout()
})
this.audio.addEventListener('loadeddata', () => {
this.maxPlayTime = this.audio.duration
if (this.audioErrorTime) {
this.audio.currentTime = this.audioErrorTime
this.audioErrorTime = 0
}
if (!this.targetSong.interval && this.listId != 'download') this.updateMusicInfo({ index: this.playIndex, data: { interval: formatPlayTime2(this.maxPlayTime) } })
this.status = '音乐加载中...'
})
@@ -241,8 +252,10 @@ export default {
},
play() {
console.log('play', this.playIndex)
this.checkDelayNextTimeout()
let targetSong = this.targetSong = this.list[this.playIndex]
this.retryNum = 0
this.audioErrorTime = 0
if (this.listId == 'download') {
if (!checkPath(targetSong.filePath) || !targetSong.isComplate || /\.ape$/.test(targetSong.filePath)) {
@@ -264,6 +277,20 @@ export default {
this.setLrc(targetSong)
}
},
checkDelayNextTimeout() {
console.log(this.delayNextTimeout)
if (this.delayNextTimeout) {
clearTimeout(this.delayNextTimeout)
this.delayNextTimeout = null
}
},
addDelayNextTimeout() {
this.checkDelayNextTimeout()
this.delayNextTimeout = setTimeout(() => {
this.delayNextTimeout = null
this.handleNext()
}, 5000)
},
handleNext() {
// if (this.list.listName === null) return
let list
@@ -276,7 +303,7 @@ export default {
}
if (!list.length) return this.setPlayIndex(-1)
let playIndex = this.list === list ? this.playIndex : list.indexOf(this.list[this.playIndex])
// console.log(playIndex)
let index
switch (this.setting.player.togglePlayMethod) {
case 'listLoop':
@@ -349,19 +376,13 @@ export default {
this.musicInfo.url = targetSong.typeUrl[type]
this.status = '歌曲链接获取中...'
let urlP = this.musicInfo.url && !isRefresh
? Promise.resolve()
: this.getUrl({ musicInfo: targetSong, type }).then(() => {
this.musicInfo.url = targetSong.typeUrl[type]
})
urlP.then(() => {
this.audio.src = this.musicInfo.url
return this.getUrl({ musicInfo: targetSong, type, isRefresh }).then(() => {
this.audio.src = this.musicInfo.url = targetSong.typeUrl[type]
}).catch(err => {
if (err.message == requestMsg.cancelRequest) return
this.status = err.message
setTimeout(() => {
this.handleNext()
}, 2000)
this.addDelayNextTimeout()
return Promise.reject(err)
})
},
setImg(targetSong) {

View File

@@ -70,8 +70,9 @@ const addTask = (list, type, store) => {
})
}
const refreshUrl = downloadInfo => {
return music[downloadInfo.musicInfo.source].getMusicUrl(downloadInfo.musicInfo, downloadInfo.type).promise
const getUrl = (downloadInfo, isRefresh) => {
const url = downloadInfo.musicInfo.typeUrl[downloadInfo.type]
return url && !isRefresh ? Promise.resolve({ url }) : music[downloadInfo.musicInfo.source].getMusicUrl(downloadInfo.musicInfo, downloadInfo.type).promise
}
// actions
@@ -116,12 +117,12 @@ const actions = {
// 检查是否可以开始任务
if (downloadInfo && downloadInfo != state.downloadStatus.WAITING) commit('setStatus', { downloadInfo, status: state.downloadStatus.WAITING })
let result = getStartTask(state.list, state.downloadStatus, rootState.setting.download.maxDownloadNum)
if (!result) return downloadInfo && commit('setStatus', { downloadInfo, status: state.downloadStatus.WAITING })
if (!result) return
if (!downloadInfo) downloadInfo = result
// 开始任务
commit('setStatusText', { downloadInfo, text: '任务初始化中' })
commit('onDownload', downloadInfo)
commit('setStatusText', { downloadInfo, text: '任务初始化中' })
let msg = checkPath(rootState.setting.download.savePath)
if (msg) return commit('setStatusText', '检查下载目录出错: ' + msg)
const _this = this
@@ -137,15 +138,18 @@ const actions = {
console.log('on complate')
},
onError(err) {
console.log(err.message)
// console.log(err.code, err.message)
commit('onError', downloadInfo)
// console.log(tryNum[downloadInfo.key])
if (++tryNum[downloadInfo.key] > 5) return
if (++tryNum[downloadInfo.key] > 5) {
_this.dispatch('download/startTask')
return
}
let code
if (err.message.includes('Response status was')) {
code = err.message.replace(/Response status was (\d+)$/, '$1')
} if (err.code === 'ETIMEDOUT') {
code = 'ETIMEDOUT'
} else if (err.code === 'ETIMEDOUT' || err.code == 'ENOTFOUND') {
code = err.code
} else {
console.log('Download failed, Attempting Retry')
dls[downloadInfo.key].resume()
@@ -157,8 +161,9 @@ const actions = {
case '403':
case '410':
case 'ETIMEDOUT':
case 'ENOTFOUND':
commit('setStatusText', { downloadInfo, text: '链接失效,正在刷新链接' })
refreshUrl(downloadInfo).then(result => {
getUrl(downloadInfo, true).then(result => {
commit('updateUrl', { downloadInfo, url: result.url })
commit('setStatusText', { downloadInfo, text: '链接刷新成功' })
dls[downloadInfo.key].url = dls[downloadInfo.key].requestURL = result.url
@@ -168,9 +173,7 @@ const actions = {
console.log(err)
_this.dispatch('download/startTask')
})
return
}
_this.dispatch('download/startTask')
},
// onStateChanged(state) {
// console.log(state)
@@ -192,7 +195,7 @@ const actions = {
},
}
commit('setStatusText', { downloadInfo, text: '获取URL中...' })
let p = options.url ? Promise.resolve() : refreshUrl(downloadInfo).then(result => {
let p = options.url ? Promise.resolve() : getUrl(downloadInfo).then(result => {
commit('updateUrl', { downloadInfo, url: result.url })
if (!result.url) return Promise.reject(new Error('获取URL失败'))
options.url = result.url

View File

@@ -22,8 +22,9 @@ const getters = {
// actions
const actions = {
getUrl({ commit, state }, { musicInfo, type }) {
getUrl({ commit, state }, { musicInfo, type, isRefresh }) {
if (urlRequest && urlRequest.cancelHttp) urlRequest.cancelHttp()
if (musicInfo.typeUrl[type] && !isRefresh) return Promise.resolve()
urlRequest = music[musicInfo.source].getMusicUrl(musicInfo, type)
return urlRequest.promise.then(result => {
commit('setUrl', { musicInfo, url: result.url, type })
@@ -72,6 +73,7 @@ const mutations = {
setPlayIndex(state, index) {
state.playIndex = index
state.changePlay = true
// console.log(state.changePlay)
},
fixPlayIndex(state, index) {
state.playIndex = index

View File

@@ -86,6 +86,10 @@ div.scroll(:class="$style.setting")
strong @messoer
|
p.small 若有问题可 mail tolyswhut@qq.com 或到 github 提交 issue
p.small
| 若觉得好用的话去GitHub点个
strong star
| 支持作者吧~
p
small By
| 落雪无痕