移除虾米源,允许播放除了搜索列表以外的所有歌曲
parent
a0254eb4f2
commit
c78811fe36
|
@ -34,18 +34,20 @@
|
|||
"publish:gh:linux": "node build-config/pack.js && npm run publish:linux",
|
||||
"publish:linux": "npm run publish:linux:deb && npm run publish:linux:appImage && npm run publish:linux:rpm && npm run publish:linux:pacman",
|
||||
"publish:linux:appImage": "cross-env ARCH=x64 electron-builder -l=AppImage -p onTagOrDraft",
|
||||
"publish:linux:deb": "npm run publish:linux:deb:x64 && npm run publish:linux:deb:x86 && npm run publish:linux:deb:arm64",
|
||||
"publish:linux:deb": "npm run publish:linux:deb:x64 && npm run publish:linux:deb:x86 && npm run publish:linux:deb:arm64 && npm run publish:linux:deb:armv7l",
|
||||
"publish:linux:deb:x64": "cross-env ARCH=x64 electron-builder -l=deb --x64 -p onTagOrDraft",
|
||||
"publish:linux:deb:x86": "cross-env ARCH=x86 electron-builder -l=deb --ia32 -p onTagOrDraft",
|
||||
"publish:linux:deb:arm64": "cross-env ARCH=arm64 electron-builder -l=deb --arm64 -p onTagOrDraft",
|
||||
"publish:linux:deb:armv7l": "cross-env ARCH=armv7l electron-builder -l=deb --armv7l -p onTagOrDraft",
|
||||
"publish:linux:rpm": "cross-env ARCH=x64 electron-builder -l=rpm --x64 -p onTagOrDraft",
|
||||
"publish:linux:pacman": "cross-env ARCH=x64 electron-builder -l=pacman --x64 -p onTagOrDraft",
|
||||
"pack:linux": "node build-config/pack.js && npm run pack:linux:deb && npm run pack:linux:appImage && npm run pack:linux:rpm && npm run pack:linux:pacman",
|
||||
"pack:linux:appImage": "cross-env ARCH=x64 electron-builder -l=AppImage",
|
||||
"pack:linux:deb": "npm run pack:linux:deb:x64 && npm run pack:linux:deb:x86 && npm run pack:linux:deb:arm64",
|
||||
"pack:linux:deb": "npm run pack:linux:deb:x64 && npm run pack:linux:deb:x86 && npm run pack:linux:deb:arm64 && npm run pack:linux:deb:armv7l",
|
||||
"pack:linux:deb:x64": "cross-env ARCH=x64 electron-builder -l=deb --x64",
|
||||
"pack:linux:deb:x86": "cross-env ARCH=x86 electron-builder -l=deb --ia32",
|
||||
"pack:linux:deb:arm64": "cross-env ARCH=arm64 electron-builder -l=deb --arm64",
|
||||
"pack:linux:deb:armv7l": "cross-env ARCH=armv7l electron-builder -l=deb --armv7l",
|
||||
"pack:linux:rpm": "cross-env ARCH=x64 electron-builder -l=rpm --x64",
|
||||
"pack:linux:pacman": "cross-env ARCH=x64 electron-builder -l=pacman --x64",
|
||||
"pack:mac": "node build-config/pack.js && electron-builder -m=dmg",
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
- 新增设置-其他-列表缓存信息清理功能,注:此功能一般情况下不要使用
|
||||
|
||||
### 优化
|
||||
|
||||
- 允许播放除了搜索列表以外的所有歌曲,即原来没有播放按钮或者灰色的歌曲都可以点击尝试去播放。注:该功能的原理是尝试自动切换到其他源播放,所以不一定会播放成功,特别是对于那些独家的资源
|
||||
|
||||
### 移除
|
||||
|
||||
- 移除虾米源。注:虽然已移除该源,但仍可尝试去播放之前添加的歌曲,虽然不一定会成功
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复音乐搜索列表的稍后播放功能无效的问题
|
||||
|
|
|
@ -91,7 +91,6 @@ import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, de
|
|||
import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { requestMsg } from '../../utils/message'
|
||||
import { player as eventPlayerNames } from '../../../common/hotKey'
|
||||
import musicSdk from '@renderer/utils/music'
|
||||
import path from 'path'
|
||||
|
||||
let audio
|
||||
|
@ -327,6 +326,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions('player', ['getUrl', 'getPic', 'getLrc', 'playPrev', 'playNext']),
|
||||
...mapActions('list', ['getOtherSource']),
|
||||
...mapMutations('player', [
|
||||
'setPlayMusicInfo',
|
||||
'setPlayIndex',
|
||||
|
@ -492,7 +492,7 @@ export default {
|
|||
this.setImg(targetSong.musicInfo)
|
||||
this.setLrc(targetSong.musicInfo)
|
||||
} else {
|
||||
if (!this.assertApiSupport(targetSong.source)) return this.playNext()
|
||||
// if (!this.assertApiSupport(targetSong.source)) return this.playNext()
|
||||
this.musicInfo.songmid = targetSong.songmid
|
||||
this.musicInfo.singer = targetSong.singer
|
||||
this.musicInfo.name = targetSong.name
|
||||
|
@ -573,7 +573,7 @@ export default {
|
|||
togglePlay() {
|
||||
if (!audio.src) {
|
||||
if (this.restorePlayTime != null) {
|
||||
if (!this.assertApiSupport(this.targetSong.source)) return this.playNext()
|
||||
// if (!this.assertApiSupport(this.targetSong.source)) return this.playNext()
|
||||
this.setUrl(this.targetSong)
|
||||
}
|
||||
return
|
||||
|
@ -613,10 +613,7 @@ export default {
|
|||
|
||||
this.status = this.statusText = 'Try toggle source...'
|
||||
|
||||
return (originMusic.otherSource && originMusic.otherSource.length ? Promise.resolve(originMusic.otherSource) : musicSdk.findMusic(originMusic)).then(res => {
|
||||
this.updateMusicInfo({ id: this.listId, index: this.playIndex, data: { otherSource: res }, musicInfo: originMusic })
|
||||
return res
|
||||
}).then(otherSource => {
|
||||
return this.getOtherSource(originMusic).then(otherSource => {
|
||||
console.log('find otherSource', otherSource)
|
||||
if (otherSource.length) {
|
||||
for (const item of otherSource) {
|
||||
|
|
|
@ -50,7 +50,7 @@ export default {
|
|||
singer: '',
|
||||
},
|
||||
page: 1,
|
||||
total: 10,
|
||||
total: 0,
|
||||
maxPage: 1,
|
||||
limit: 20,
|
||||
isHotLoading: true,
|
||||
|
|
|
@ -31,8 +31,6 @@ div(:class="$style.songList")
|
|||
td(:style="{ width: rowWidth.r6 }" style="padding-left: 0; padding-right: 0;")
|
||||
material-list-buttons(:index="index" :class="$style.btns"
|
||||
:remove-btn="false" @btn-click="handleListBtnClick"
|
||||
:listAdd-btn="assertApiSupport(item.source)"
|
||||
:play-btn="assertApiSupport(item.source)"
|
||||
:download-btn="assertApiSupport(item.source)")
|
||||
//- 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)') 试听
|
||||
|
@ -243,7 +241,7 @@ export default {
|
|||
this.clickIndex = index
|
||||
return
|
||||
}
|
||||
this.emitEvent(this.assertApiSupport(this.source) ? 'testPlay' : 'search', index)
|
||||
this.emitEvent('testPlay', index)
|
||||
this.clickTime = 0
|
||||
this.clickIndex = -1
|
||||
},
|
||||
|
@ -340,9 +338,9 @@ export default {
|
|||
},
|
||||
handleListItemRigthClick(event, index) {
|
||||
this.listMenu.itemMenuControl.sourceDetail = !!musicSdk[this.list[index].source].getMusicDetailPageUrl
|
||||
this.listMenu.itemMenuControl.play =
|
||||
this.listMenu.itemMenuControl.playLater =
|
||||
this.listMenu.itemMenuControl.download =
|
||||
// this.listMenu.itemMenuControl.play =
|
||||
// this.listMenu.itemMenuControl.playLater =
|
||||
this.listMenu.itemMenuControl.download =
|
||||
this.assertApiSupport(this.list[index].source)
|
||||
let dom_selected = this.$refs.dom_tbody.querySelector('tr.selected')
|
||||
if (dom_selected) dom_selected.classList.remove('selected')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import musicSdk from '../../utils/music'
|
||||
|
||||
let allList = {}
|
||||
window.allList = allList
|
||||
|
||||
|
@ -48,7 +50,12 @@ const getters = {
|
|||
|
||||
// actions
|
||||
const actions = {
|
||||
|
||||
getOtherSource({ state, commit }, musicInfo) {
|
||||
return (musicInfo.otherSource && musicInfo.otherSource.length ? Promise.resolve(musicInfo.otherSource) : musicSdk.findMusic(musicInfo)).then(otherSource => {
|
||||
commit('setOtherSource', { musicInfo, otherSource })
|
||||
return otherSource
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
// mitations
|
||||
|
@ -217,6 +224,9 @@ const mutations = {
|
|||
}
|
||||
}
|
||||
},
|
||||
setOtherSource(state, { musicInfo, otherSource }) {
|
||||
musicInfo.otherSource = otherSource
|
||||
},
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
@ -18,8 +18,8 @@ const state = {
|
|||
}
|
||||
|
||||
let urlRequest
|
||||
let picRequest
|
||||
let lrcRequest
|
||||
// let picRequest
|
||||
// let lrcRequest
|
||||
|
||||
const filterList = async({ playedList, listInfo, savePath, commit }) => {
|
||||
// if (this.list.listName === null) return
|
||||
|
@ -44,7 +44,7 @@ const filterList = async({ playedList, listInfo, savePath, commit }) => {
|
|||
}
|
||||
} else {
|
||||
list = listInfo.list.filter(s => {
|
||||
if (!assertApiSupport(s.source)) return false
|
||||
// if (!assertApiSupport(s.source)) return false
|
||||
canPlayList.push(s)
|
||||
|
||||
let index = filteredPlayedList.indexOf(s)
|
||||
|
@ -62,6 +62,42 @@ const filterList = async({ playedList, listInfo, savePath, commit }) => {
|
|||
return list
|
||||
}
|
||||
|
||||
const getPic = function(musicInfo, retryedSource = [], originMusic) {
|
||||
console.log(musicInfo.source)
|
||||
return music[musicInfo.source].getPic(musicInfo).promise.catch(err => {
|
||||
if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source)
|
||||
return this.dispatch('list/getOtherSource', musicInfo).then(otherSource => {
|
||||
if (!originMusic) originMusic = musicInfo
|
||||
console.log('find otherSource', otherSource)
|
||||
if (otherSource.length) {
|
||||
for (const item of otherSource) {
|
||||
if (retryedSource.includes(item.source)) continue
|
||||
console.log('try toggle to: ', item.source, item.name, item.singer, item.interval)
|
||||
return getPic.call(this, item, retryedSource, originMusic)
|
||||
}
|
||||
}
|
||||
return Promise.reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
const getLyric = function(musicInfo, retryedSource = [], originMusic) {
|
||||
return music[musicInfo.source].getLyric(musicInfo).promise.catch(err => {
|
||||
if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source)
|
||||
return this.dispatch('list/getOtherSource', musicInfo).then(otherSource => {
|
||||
if (!originMusic) originMusic = musicInfo
|
||||
console.log('find otherSource', otherSource)
|
||||
if (otherSource.length) {
|
||||
for (const item of otherSource) {
|
||||
if (retryedSource.includes(item.source)) continue
|
||||
console.log('try toggle to: ', item.source, item.name, item.singer, item.interval)
|
||||
return getLyric.call(this, item, retryedSource, originMusic)
|
||||
}
|
||||
}
|
||||
return Promise.reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// getters
|
||||
const getters = {
|
||||
list: state => state.listInfo.list,
|
||||
|
@ -120,7 +156,11 @@ const actions = {
|
|||
}
|
||||
if (urlRequest && urlRequest.cancelHttp) urlRequest.cancelHttp()
|
||||
if (musicInfo.typeUrl[type] && !isRefresh) return Promise.resolve(musicInfo.typeUrl[type])
|
||||
urlRequest = music[musicInfo.source].getMusicUrl(musicInfo, type)
|
||||
try {
|
||||
urlRequest = music[musicInfo.source].getMusicUrl(musicInfo, type)
|
||||
} catch (err) {
|
||||
return Promise.reject(err)
|
||||
}
|
||||
return urlRequest.promise.then(({ url }) => {
|
||||
if (originMusic) commit('setUrl', { musicInfo: originMusic, url, type })
|
||||
commit('setUrl', { musicInfo, url, type })
|
||||
|
@ -132,18 +172,18 @@ const actions = {
|
|||
})
|
||||
},
|
||||
getPic({ commit, state }, musicInfo) {
|
||||
if (picRequest && picRequest.cancelHttp) picRequest.cancelHttp()
|
||||
picRequest = music[musicInfo.source].getPic(musicInfo)
|
||||
return picRequest.promise.then(url => {
|
||||
picRequest = null
|
||||
// if (picRequest && picRequest.cancelHttp) picRequest.cancelHttp()
|
||||
// picRequest = music[musicInfo.source].getPic(musicInfo)
|
||||
return getPic.call(this, musicInfo).then(url => {
|
||||
// picRequest = null
|
||||
commit('getPic', { musicInfo, url })
|
||||
}).catch(err => {
|
||||
picRequest = null
|
||||
// picRequest = null
|
||||
return Promise.reject(err)
|
||||
})
|
||||
},
|
||||
getLrc({ commit, state }, musicInfo) {
|
||||
if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp()
|
||||
// if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp()
|
||||
if (musicInfo.lrc && musicInfo.tlrc != null) {
|
||||
if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) {
|
||||
let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '')
|
||||
|
@ -153,12 +193,12 @@ const actions = {
|
|||
}
|
||||
|
||||
|
||||
lrcRequest = music[musicInfo.source].getLyric(musicInfo)
|
||||
return lrcRequest.promise.then(({ lyric, tlyric }) => {
|
||||
lrcRequest = null
|
||||
// lrcRequest = music[musicInfo.source].getLyric(musicInfo)
|
||||
return getLyric.call(this, musicInfo).then(({ lyric, tlyric }) => {
|
||||
// lrcRequest = null
|
||||
commit('setLrc', { musicInfo, lyric, tlyric })
|
||||
}).catch(err => {
|
||||
lrcRequest = null
|
||||
// lrcRequest = null
|
||||
return Promise.reject(err)
|
||||
})
|
||||
},
|
||||
|
|
|
@ -11,7 +11,6 @@ module.exports = [
|
|||
tx: ['128k'],
|
||||
wy: ['128k'],
|
||||
mg: ['128k'],
|
||||
xm: ['128k'],
|
||||
// bd: ['128k'],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -87,7 +87,7 @@ export default {
|
|||
item.name = trimStr(item.name)
|
||||
item.lowerCaseName = String(item.name).toLowerCase()
|
||||
item.lowerCaseAlbumName = String(item.albumName).toLowerCase()
|
||||
console.log(lowerCaseName, item.lowerCaseName)
|
||||
// console.log(lowerCaseName, item.lowerCaseName)
|
||||
if (
|
||||
(
|
||||
item.sortedSinger === sortedSinger &&
|
||||
|
|
|
@ -1,39 +1,54 @@
|
|||
import { apis } from '../api-source'
|
||||
import leaderboard from './leaderboard'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
// import { apis } from '../api-source'
|
||||
// import leaderboard from './leaderboard'
|
||||
// import songList from './songList'
|
||||
// import musicSearch from './musicSearch'
|
||||
// import pic from './pic'
|
||||
import lyric from './lyric'
|
||||
import hotSearch from './hotSearch'
|
||||
import comment from './comment'
|
||||
import musicInfo from './musicInfo'
|
||||
import { closeVerifyModal } from './util'
|
||||
// import lyric from './lyric'
|
||||
// import hotSearch from './hotSearch'
|
||||
// import comment from './comment'
|
||||
// import musicInfo from './musicInfo'
|
||||
// import { closeVerifyModal } from './util'
|
||||
|
||||
const xm = {
|
||||
songList,
|
||||
musicSearch,
|
||||
leaderboard,
|
||||
hotSearch,
|
||||
closeVerifyModal,
|
||||
comment,
|
||||
// songList,
|
||||
// musicSearch,
|
||||
// leaderboard,
|
||||
// hotSearch,
|
||||
// closeVerifyModal,
|
||||
comment: {
|
||||
getComment() {
|
||||
return Promise.reject(new Error('fail'))
|
||||
},
|
||||
getHotComment() {
|
||||
return Promise.reject(new Error('fail'))
|
||||
},
|
||||
},
|
||||
getMusicUrl(songInfo, type) {
|
||||
return apis('xm').getMusicUrl(songInfo, type)
|
||||
return {
|
||||
promise: Promise.reject(new Error('fail')),
|
||||
}
|
||||
// return apis('xm').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return lyric.getLyric(songInfo)
|
||||
return {
|
||||
promise: Promise.reject(new Error('fail')),
|
||||
}
|
||||
// return lyric.getLyric(songInfo)
|
||||
},
|
||||
getPic(songInfo) {
|
||||
return Promise.reject(new Error('fail'))
|
||||
return {
|
||||
promise: Promise.reject(new Error('fail')),
|
||||
}
|
||||
// return pic.getPic(songInfo)
|
||||
},
|
||||
getMusicDetailPageUrl(songInfo) {
|
||||
if (songInfo.songStringId) return `https://www.xiami.com/song/${songInfo.songStringId}`
|
||||
// getMusicDetailPageUrl(songInfo) {
|
||||
// if (songInfo.songStringId) return `https://www.xiami.com/song/${songInfo.songStringId}`
|
||||
|
||||
musicInfo.getMusicInfo(songInfo).then(({ data }) => {
|
||||
songInfo.songStringId = data.songStringId
|
||||
})
|
||||
return `https://www.xiami.com/song/${songInfo.songmid}`
|
||||
},
|
||||
// musicInfo.getMusicInfo(songInfo).then(({ data }) => {
|
||||
// songInfo.songStringId = data.songStringId
|
||||
// })
|
||||
// return `https://www.xiami.com/song/${songInfo.songmid}`
|
||||
// },
|
||||
// init() {
|
||||
// getToken()
|
||||
// },
|
||||
|
|
|
@ -68,7 +68,7 @@ export const xmRequest = (path, params = '') => {
|
|||
isCancelled: false,
|
||||
cancelHttp() {
|
||||
if (!this.isInited) this.isCancelled = true
|
||||
this.requestObj.cancelHttp()
|
||||
this.requestObj && this.requestObj.cancelHttp()
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@ export default {
|
|||
}
|
||||
},
|
||||
testPlay(index) {
|
||||
if (!this.assertApiSupport(this.list[index].source)) return
|
||||
// if (!this.assertApiSupport(this.list[index].source)) return
|
||||
this.setPlayList({ list: this.listData, index })
|
||||
},
|
||||
handleRemove(index) {
|
||||
|
@ -579,7 +579,7 @@ export default {
|
|||
switch (info.action) {
|
||||
case 'download': {
|
||||
const minfo = this.list[info.index]
|
||||
if (!this.assertApiSupport(minfo.source)) return
|
||||
// if (!this.assertApiSupport(minfo.source)) return
|
||||
this.musicInfo = minfo
|
||||
this.$nextTick(() => {
|
||||
this.isShowDownload = true
|
||||
|
@ -732,9 +732,9 @@ export default {
|
|||
},
|
||||
handleListItemRigthClick(event, index) {
|
||||
this.listMenu.itemMenuControl.sourceDetail = !!musicSdk[this.list[index].source].getMusicDetailPageUrl
|
||||
this.listMenu.itemMenuControl.play =
|
||||
this.listMenu.itemMenuControl.playLater =
|
||||
this.listMenu.itemMenuControl.download =
|
||||
// this.listMenu.itemMenuControl.play =
|
||||
// this.listMenu.itemMenuControl.playLater =
|
||||
this.listMenu.itemMenuControl.download =
|
||||
this.assertApiSupport(this.list[index].source)
|
||||
let dom_selected = this.$refs.dom_tbody.querySelector('tr.selected')
|
||||
if (dom_selected) dom_selected.classList.remove('selected')
|
||||
|
|
|
@ -239,7 +239,7 @@ export default {
|
|||
break
|
||||
case 'play':
|
||||
if (this.selectedData.length) {
|
||||
this.listAddMultiple({ id: 'default', list: this.filterList(this.selectedData) })
|
||||
this.listAddMultiple({ id: 'default', list: [...this.selectedData] })
|
||||
this.resetSelect()
|
||||
}
|
||||
this.testPlay(info.index)
|
||||
|
|
Loading…
Reference in New Issue