分离可用音质控制逻辑
parent
e51ee8c1ad
commit
a62d8304e2
|
@ -1217,9 +1217,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/uglify-js": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.0.5.tgz",
|
||||
"integrity": "sha512-L7EbSkhSaWBpkl+PZAEAqZTqtTeIsq7s/oX/q0LNnxxJoRVKQE0T81XDVyaxjiiKQwiV2vhVeYRqxdRNqGOGJw==",
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.9.0.tgz",
|
||||
"integrity": "sha512-3ZcoyPYHVOCcLpnfZwD47KFLr8W/mpUcgjpf1M4Q78TMJIw7KMAHSjiCLJp1z3ZrBR9pTLbe191O0TldFK5zcw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-map": "^0.6.1"
|
||||
|
@ -1234,9 +1234,9 @@
|
|||
}
|
||||
},
|
||||
"@types/webpack": {
|
||||
"version": "4.41.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.10.tgz",
|
||||
"integrity": "sha512-vIy0qaq8AjOjZLuFPqpo7nAJzcoVXMdw3mvpNN07Uvdy0p1IpJeLNBe3obdRP7FX2jIusDE7z1pZa0A6qYUgnA==",
|
||||
"version": "4.41.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.12.tgz",
|
||||
"integrity": "sha512-BpCtM4NnBen6W+KEhrL9jKuZCXVtiH6+0b6cxdvNt2EwU949Al334PjQSl2BeAyvAX9mgoNNG21wvjP3xZJJ5w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/anymatch": "*",
|
||||
|
@ -5339,9 +5339,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"electron": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-8.2.3.tgz",
|
||||
"integrity": "sha512-FJUp103c8yJBoAaj/QM/OBde57iJh95u1yGJBytMUXmLFSsx78LmNE03QN4XCODyzi76IEcasvUcK6scogRLbQ==",
|
||||
"version": "8.2.4",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-8.2.4.tgz",
|
||||
"integrity": "sha512-Lle0InIgSAHZxD5KDY0wZ1A2Zlc6GHwMhAxoHMzn05mndyP1YBkCYHc0TDDofzUTrsLFofduPjlknO5Oj9fTPA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^1.0.1",
|
||||
|
@ -5350,9 +5350,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.12.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.36.tgz",
|
||||
"integrity": "sha512-hmmypvyO/uTLFYCYu6Hlb3ydeJ11vXRxg8/WJ0E3wvwmPO0y47VqnfmXFVuWlysO0Zyj+je1Y33rQeuYkZ51GQ==",
|
||||
"version": "12.12.37",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz",
|
||||
"integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
@ -8427,9 +8427,9 @@
|
|||
}
|
||||
},
|
||||
"html-webpack-plugin": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.2.0.tgz",
|
||||
"integrity": "sha512-zL7LYTuq/fcJX6vV6tmmvFR508Bd9e6kvVGbS76YAjZ2CPVRzsjkvDYs/SshPevpolSdTWgaDV39D6k6oQoVFw==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.2.1.tgz",
|
||||
"integrity": "sha512-zTTPxKJ8bgRe4RVDzT1MZW8ysW5wwDfJmD3AN+7mw2MKMWZJibZzBgHaDqnL6FJg1kvk38sQPMJNmI8Q1Ntr9A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/html-minifier-terser": "^5.0.0",
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly --fix src"
|
||||
},
|
||||
"browserslist": [
|
||||
"Electron 8.2.3"
|
||||
"Electron 8.2.4"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
|
@ -160,7 +160,7 @@
|
|||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^3.5.3",
|
||||
"del": "^5.1.0",
|
||||
"electron": "^8.2.3",
|
||||
"electron": "^8.2.4",
|
||||
"electron-builder": "^22.5.1",
|
||||
"electron-debug": "^3.0.1",
|
||||
"electron-devtools-installer": "^3.0.0",
|
||||
|
@ -175,7 +175,7 @@
|
|||
"eslint-plugin-standard": "^4.0.1",
|
||||
"file-loader": "^6.0.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"html-webpack-plugin": "^4.2.0",
|
||||
"html-webpack-plugin": "^4.2.1",
|
||||
"less": "^3.11.1",
|
||||
"less-loader": "^6.0.0",
|
||||
"markdown-it": "^10.0.0",
|
||||
|
|
|
@ -34,5 +34,5 @@
|
|||
|
||||
### 其他
|
||||
|
||||
更新 Electron 到 8.2.3
|
||||
更新 Electron 到 8.2.4
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ export default {
|
|||
apiSource: 'test',
|
||||
proxy: {},
|
||||
isShowPact: false,
|
||||
qualityList: {},
|
||||
xm: {
|
||||
isShowVerify: false,
|
||||
},
|
||||
|
@ -121,6 +122,7 @@ export default {
|
|||
this.saveSearchHistoryList(n)
|
||||
},
|
||||
'globalObj.apiSource'(n) {
|
||||
this.globalObj.qualityList = music.supportQuality[n]
|
||||
if (n != this.setting.apiSource) {
|
||||
this.setSetting(Object.assign({}, this.setting, {
|
||||
apiSource: n,
|
||||
|
@ -196,6 +198,7 @@ export default {
|
|||
|
||||
this.initData()
|
||||
this.globalObj.apiSource = this.setting.apiSource
|
||||
this.globalObj.qualityList = music.supportQuality[this.setting.apiSource]
|
||||
this.globalObj.proxy = Object.assign({}, this.setting.network.proxy)
|
||||
window.globalObj = this.globalObj
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ div(:class="$style.player")
|
|||
<script>
|
||||
import Lyric from 'lrc-file-parser'
|
||||
import { rendererSend } from '../../../common/ipc'
|
||||
import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, debounce } from '../../utils'
|
||||
import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, debounce, assertApiSupport } from '../../utils'
|
||||
import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { requestMsg } from '../../utils/message'
|
||||
import { isMac } from '../../../common/utils'
|
||||
|
@ -125,9 +125,6 @@ export default {
|
|||
progress() {
|
||||
return this.nowPlayTime / this.maxPlayTime || 0
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
|
@ -368,10 +365,8 @@ export default {
|
|||
const filePath = path.join(this.setting.download.savePath, item.fileName)
|
||||
if ((!await checkPath(filePath) || !item.isComplate || /\.ape$/.test(filePath))) list.push(item)
|
||||
}
|
||||
} else if (this.isAPITemp) {
|
||||
list = this.list.filter(s => s.source == 'kw')
|
||||
} else {
|
||||
list = this.list
|
||||
list = this.list.filter(s => this.assertApiSupport(s.source))
|
||||
}
|
||||
return list
|
||||
},
|
||||
|
@ -379,7 +374,7 @@ export default {
|
|||
// console.log(playIndex)
|
||||
let list = await this.filterList()
|
||||
if (!list.length) return this.setPlayIndex(-1)
|
||||
let playIndex = this.list === list ? this.playIndex : list.indexOf(this.list[this.playIndex])
|
||||
let playIndex = list.indexOf(this.list[this.playIndex])
|
||||
let index
|
||||
switch (this.setting.player.togglePlayMethod) {
|
||||
case 'random':
|
||||
|
@ -393,14 +388,14 @@ export default {
|
|||
return
|
||||
}
|
||||
if (index < 0) return
|
||||
if (this.list !== list) index = this.list.indexOf(list[index])
|
||||
index = this.list.indexOf(list[index])
|
||||
this.setPlayIndex(index)
|
||||
},
|
||||
async handleNext() {
|
||||
// if (this.list.listName === null) return
|
||||
let list = await this.filterList()
|
||||
if (!list.length) return this.setPlayIndex(-1)
|
||||
let playIndex = this.list === list ? this.playIndex : list.indexOf(this.list[this.playIndex])
|
||||
let playIndex = list.indexOf(this.list[this.playIndex])
|
||||
// console.log(playIndex)
|
||||
let index
|
||||
switch (this.setting.player.togglePlayMethod) {
|
||||
|
@ -417,7 +412,7 @@ export default {
|
|||
return
|
||||
}
|
||||
if (index < 0) return
|
||||
if (this.list !== list) index = this.list.indexOf(list[index])
|
||||
index = this.list.indexOf(list[index])
|
||||
this.setPlayIndex(index)
|
||||
},
|
||||
hanldeListRandom(list, index) {
|
||||
|
@ -470,14 +465,9 @@ export default {
|
|||
this.musicInfo.img = null
|
||||
},
|
||||
getPlayType(highQuality, songInfo) {
|
||||
switch (songInfo.source) {
|
||||
case 'wy':
|
||||
case 'tx':
|
||||
return '128k'
|
||||
// case 'kg':
|
||||
}
|
||||
let type = '128k'
|
||||
if (highQuality && songInfo._types['320k']) type = '320k'
|
||||
let list = window.globalObj.qualityList[songInfo.source]
|
||||
if (highQuality && songInfo._types['320k'] && list && list.includes('320k')) type = '320k'
|
||||
return type
|
||||
},
|
||||
setUrl(targetSong, isRefresh, isRetryed = false) {
|
||||
|
@ -654,6 +644,9 @@ export default {
|
|||
break
|
||||
}
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -29,6 +29,9 @@ export default {
|
|||
info() {
|
||||
return this.musicInfo || {}
|
||||
},
|
||||
qualityList() {
|
||||
return window.globalObj.qualityList[this.musicInfo.source]
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleClick(type) {
|
||||
|
@ -51,16 +54,7 @@ export default {
|
|||
}
|
||||
},
|
||||
checkSource(type) {
|
||||
switch (this.musicInfo.source) {
|
||||
case 'wy':
|
||||
case 'tx':
|
||||
return type == '128k'
|
||||
case 'xm':
|
||||
return type == '128k' || type == '320k'
|
||||
|
||||
default:
|
||||
return true
|
||||
}
|
||||
return this.qualityList.includes(type)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ div(:class="$style.songList")
|
|||
td(style="width: 20%; padding-left: 0; padding-right: 0;")
|
||||
material-list-buttons(:index="index" :search-btn="true"
|
||||
:remove-btn="false" @btn-click="handleListBtnClick"
|
||||
:listAdd-btn="item.source == 'kw' || !isAPITemp"
|
||||
:play-btn="item.source == 'kw' || !isAPITemp"
|
||||
:download-btn="item.source == 'kw' || !isAPITemp")
|
||||
: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)') 试听
|
||||
//- button.btn-success(type='button' v-if="(item._types['128k'] || item._types['192k'] || item._types['320k']) && userInfo" @click.stop='showListModal(index)') +
|
||||
|
@ -41,12 +41,12 @@ div(:class="$style.songList")
|
|||
transition(enter-active-class="animated-fast fadeIn" leave-active-class="animated-fast fadeOut")
|
||||
div(v-show="!list.length" :class="$style.noitem")
|
||||
p(v-html="noItem")
|
||||
material-flow-btn(:show="isShowEditBtn && (source == 'kw' || !isAPITemp)" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
material-flow-btn(:show="isShowEditBtn && assertApiSupport(source)" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { scrollTo, clipboardWriteText } from '../../utils'
|
||||
import { scrollTo, clipboardWriteText, assertApiSupport } from '../../utils'
|
||||
export default {
|
||||
name: 'MaterialSongList',
|
||||
model: {
|
||||
|
@ -86,9 +86,6 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapGetters(['setting']),
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selectdList(n) {
|
||||
|
@ -185,7 +182,7 @@ export default {
|
|||
this.clickIndex = index
|
||||
return
|
||||
}
|
||||
this.emitEvent((this.source == 'kw' || !this.isAPITemp) ? 'testPlay' : 'search', index)
|
||||
this.emitEvent(this.assertApiSupport(this.source) ? 'testPlay' : 'search', index)
|
||||
this.clickTime = 0
|
||||
this.clickIndex = -1
|
||||
},
|
||||
|
@ -274,6 +271,9 @@ export default {
|
|||
clipboardWriteText(str)
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"btn_tip": "腾讯、网易音源仅支持下载128k音质\n虾米音源不支持下载无损音质",
|
||||
"btn_tip": "该音质不可用",
|
||||
"lossless": "无损音质",
|
||||
"high_quality": "高品音质",
|
||||
"normal": "普通音质"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"btn_tip": "騰訊、網易、音源僅支持下載128k音質\n蝦米音源不支持下載無損音質",
|
||||
"btn_tip": "該音質不可用",
|
||||
"lossless": "無損音質",
|
||||
"high_quality": "高品音質",
|
||||
"normal": "普通音質"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"btn_tip": "Tencent and NetEase only support 128k audio quality\nXiami sources does not support 128k audio quality",
|
||||
"btn_tip": "The audio quality is not available",
|
||||
"lossless": "Lossless",
|
||||
"high_quality": "High Quality",
|
||||
"normal": "Normal"
|
||||
|
|
|
@ -207,6 +207,7 @@ const actions = {
|
|||
}
|
||||
},
|
||||
createDownloadMultiple({ state, rootState }, { list, type }) {
|
||||
if (!list.length) return
|
||||
addTask([...list], type, this)
|
||||
},
|
||||
async startTask({ commit, state, rootState }, downloadInfo) {
|
||||
|
|
|
@ -428,3 +428,6 @@ export const setWindowSize = (width, height) => rendererSend('setWindowSize', {
|
|||
export const getProxyInfo = () => window.globalObj.proxy.enable
|
||||
? `http://${window.globalObj.proxy.username}:${window.globalObj.proxy.password}@${window.globalObj.proxy.host}:${window.globalObj.proxy.port};`
|
||||
: undefined
|
||||
|
||||
|
||||
export const assertApiSupport = source => window.globalObj.qualityList[source] != undefined
|
||||
|
|
|
@ -12,7 +12,7 @@ import xm_api_test from './xm/api-test'
|
|||
// import wy_api_internal from './wy/api-internal'
|
||||
// import bd_api_internal from './bd/api-internal'
|
||||
|
||||
const apis = {
|
||||
const apiList = {
|
||||
kw_api_test,
|
||||
tx_api_test,
|
||||
kg_api_test,
|
||||
|
@ -32,15 +32,15 @@ const apis = {
|
|||
const getAPI = source => {
|
||||
switch (window.globalObj.apiSource) {
|
||||
// case 'messoer':
|
||||
// return apis[`${source}_api_messoer`]
|
||||
// return apiList[`${source}_api_messoer`]
|
||||
case 'test':
|
||||
return apis[`${source}_api_test`]
|
||||
return apiList[`${source}_api_test`]
|
||||
case 'temp':
|
||||
return apis[`${source}_api_temp`]
|
||||
return apiList[`${source}_api_temp`]
|
||||
}
|
||||
}
|
||||
|
||||
export default source => {
|
||||
export const apis = source => {
|
||||
switch (source) {
|
||||
case 'tx':
|
||||
return getAPI('tx')
|
||||
|
@ -58,3 +58,18 @@ export default source => {
|
|||
return getAPI('kw')
|
||||
}
|
||||
}
|
||||
|
||||
export const supportQuality = {
|
||||
temp: {
|
||||
kw: ['128k'],
|
||||
},
|
||||
test: {
|
||||
kw: ['128k'],
|
||||
kg: ['128k'],
|
||||
tx: ['128k'],
|
||||
wy: ['128k'],
|
||||
mg: ['128k'],
|
||||
xm: ['128k'],
|
||||
bd: ['128k'],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import leaderboard from './leaderboard'
|
||||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import musicInfo from './musicInfo'
|
||||
import songList from './songList'
|
||||
import { httpFetch } from '../../request'
|
||||
|
@ -12,7 +12,7 @@ const bd = {
|
|||
musicSearch,
|
||||
hotSearch,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('bd').getMusicUrl(songInfo, type)
|
||||
return apis('bd').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getPic(songInfo) {
|
||||
const requestObj = this.getMusicInfo(songInfo)
|
||||
|
@ -25,10 +25,10 @@ const bd = {
|
|||
return requestObj
|
||||
},
|
||||
// getLyric(songInfo) {
|
||||
// return api_source('bd').getLyric(songInfo)
|
||||
// return apis('bd').getLyric(songInfo)
|
||||
// },
|
||||
// getPic(songInfo) {
|
||||
// return api_source('bd').getPic(songInfo)
|
||||
// return apis('bd').getPic(songInfo)
|
||||
// },
|
||||
getMusicInfo(songInfo) {
|
||||
return musicInfo.getMusicInfo(songInfo.songmid)
|
||||
|
|
|
@ -5,6 +5,9 @@ import wy from './wy'
|
|||
import mg from './mg'
|
||||
import bd from './bd'
|
||||
import xm from './xm'
|
||||
import { supportQuality } from './api-source'
|
||||
|
||||
|
||||
const sources = {
|
||||
sources: [
|
||||
{
|
||||
|
@ -52,4 +55,5 @@ export default {
|
|||
sm && sm.init && sm.init()
|
||||
}
|
||||
},
|
||||
supportQuality,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import leaderboard from './leaderboard'
|
||||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
import pic from './pic'
|
||||
|
@ -12,19 +12,19 @@ const kg = {
|
|||
musicSearch,
|
||||
hotSearch,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('kg').getMusicUrl(songInfo, type)
|
||||
return apis('kg').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return lyric.getLyric(songInfo)
|
||||
},
|
||||
// getLyric(songInfo) {
|
||||
// return api_source('kg').getLyric(songInfo)
|
||||
// return apis('kg').getLyric(songInfo)
|
||||
// },
|
||||
getPic(songInfo) {
|
||||
return pic.getPic(songInfo)
|
||||
},
|
||||
// getPic(songInfo) {
|
||||
// return api_source('kg').getPic(songInfo)
|
||||
// return apis('kg').getPic(songInfo)
|
||||
// },
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { formatSinger, getToken } from './util'
|
|||
import leaderboard from './leaderboard'
|
||||
import lyric from './lyric'
|
||||
import pic from './pic'
|
||||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import songList from './songList'
|
||||
import hotSearch from './hotSearch'
|
||||
|
||||
|
@ -58,7 +58,7 @@ const kw = {
|
|||
},
|
||||
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('kw').getMusicUrl(songInfo, type)
|
||||
return apis('kw').getMusicUrl(songInfo, type)
|
||||
},
|
||||
|
||||
getMusicInfo(songInfo) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import leaderboard from './leaderboard'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
|
@ -12,7 +12,7 @@ const mg = {
|
|||
leaderboard,
|
||||
hotSearch,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('mg').getMusicUrl(songInfo, type)
|
||||
return apis('mg').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return lyric.getLyric(songInfo)
|
||||
|
|
|
@ -2,7 +2,7 @@ import leaderboard from './leaderboard'
|
|||
import lyric from './lyric'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import hotSearch from './hotSearch'
|
||||
|
||||
const tx = {
|
||||
|
@ -12,14 +12,14 @@ const tx = {
|
|||
hotSearch,
|
||||
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('tx').getMusicUrl(songInfo, type)
|
||||
return apis('tx').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
// let singer = songInfo.singer.indexOf('、') > -1 ? songInfo.singer.split('、')[0] : songInfo.singer
|
||||
return lyric.getLyric(songInfo.songmid)
|
||||
},
|
||||
getPic(songInfo) {
|
||||
return api_source('tx').getPic(songInfo)
|
||||
return apis('tx').getPic(songInfo)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -8,14 +8,9 @@ import crypto from 'crypto'
|
|||
|
||||
const types = ['flac', 'wav', 'ape', '320k', '192k', '128k']
|
||||
export const getMusicType = (info, type) => {
|
||||
switch (info.source) {
|
||||
// case 'kg':
|
||||
case 'wy':
|
||||
case 'tx':
|
||||
return '128k'
|
||||
case 'xm':
|
||||
if (type == 'wav') type = '320k'
|
||||
}
|
||||
let list = window.globalObj.qualityList[info.source]
|
||||
if (!list) return '128k'
|
||||
if (!list.includes(type)) type = list[list.length - 1]
|
||||
const rangeType = types.slice(types.indexOf(type))
|
||||
for (const type of rangeType) {
|
||||
if (info._types[type]) return type
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import leaderboard from './leaderboard'
|
||||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import getLyric from './lyric'
|
||||
import getMusicInfo from './musicInfo'
|
||||
import musicSearch from './musicSearch'
|
||||
|
@ -12,7 +12,7 @@ const wy = {
|
|||
songList,
|
||||
hotSearch,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('wy').getMusicUrl(songInfo, type)
|
||||
return apis('wy').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return getLyric(songInfo.songmid)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import api_source from '../api-source'
|
||||
import { apis } from '../api-source'
|
||||
import leaderboard from './leaderboard'
|
||||
import songList from './songList'
|
||||
import musicSearch from './musicSearch'
|
||||
|
@ -14,7 +14,7 @@ const xm = {
|
|||
hotSearch,
|
||||
closeVerifyModal,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return api_source('xm').getMusicUrl(songInfo, type)
|
||||
return apis('xm').getMusicUrl(songInfo, type)
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
return lyric.getLyric(songInfo)
|
||||
|
|
|
@ -34,9 +34,6 @@ export default {
|
|||
types() {
|
||||
return this.source ? this.sourceInfo.sourceList[this.source] : []
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
tabId(n, o) {
|
||||
|
@ -124,14 +121,7 @@ export default {
|
|||
this.isShowDownload = false
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
// case 'kg':
|
||||
case 'tx':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
case 'xm':
|
||||
if (type == 'flac') type = 'wav'
|
||||
}
|
||||
if (this.source == 'xm' && type == 'flac') type = 'wav'
|
||||
this.createDownloadMultiple({ list: [...this.selectdData], type })
|
||||
this.isShowDownloadMultiple = false
|
||||
this.resetSelect()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
table
|
||||
tbody(@contextmenu="handleContextMenu" ref="dom_tbody")
|
||||
tr(v-for='(item, index) in list' :key='item.songmid' :id="'mid_' + item.songmid"
|
||||
@click="handleDoubleClick($event, index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') ? $style.disabled : '']")
|
||||
@click="handleDoubleClick($event, index)" :class="[isPlayList && playIndex === index ? $style.active : '', assertApiSupport(item.source) ? null : $style.disabled]")
|
||||
td.nobreak.center(style="width: 37px;" :class="$style.noSelect" @click.stop) {{index + 1}}
|
||||
td.break(style="width: 25%;")
|
||||
span.select {{item.name}}
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
<script>
|
||||
import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||
import { throttle, scrollTo, clipboardWriteText } from '../utils'
|
||||
import { throttle, scrollTo, clipboardWriteText, assertApiSupport } from '../utils'
|
||||
export default {
|
||||
name: 'List',
|
||||
data() {
|
||||
|
@ -88,9 +88,6 @@ export default {
|
|||
list() {
|
||||
return this.listData.list
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
listData() {
|
||||
if (!this.listId) return this.defaultList
|
||||
let targetList
|
||||
|
@ -333,7 +330,7 @@ export default {
|
|||
}
|
||||
},
|
||||
testPlay(index) {
|
||||
if (this.isAPITemp && this.list[index].source != 'kw') return
|
||||
if (!this.assertApiSupport(this.list[index].source)) return
|
||||
this.setPlayList({ list: this.list, listId: this.listId, index })
|
||||
},
|
||||
handleRemove(index) {
|
||||
|
@ -343,7 +340,7 @@ export default {
|
|||
switch (info.action) {
|
||||
case 'download': {
|
||||
const minfo = this.list[info.index]
|
||||
if (this.isAPITemp && minfo.source != 'kw') return
|
||||
if (!this.assertApiSupport(minfo.source)) return
|
||||
this.musicInfo = minfo
|
||||
this.$nextTick(() => {
|
||||
this.isShowDownload = true
|
||||
|
@ -378,7 +375,7 @@ export default {
|
|||
// asyncSetArray(this.selectdData, isSelect ? [...this.list] : [])
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
const list = this.setting.apiSource == 'temp' ? this.selectdData.filter(s => s.source == 'kw') : [...this.selectdData]
|
||||
const list = this.selectdData.filter(s => this.assertApiSupport(s.source))
|
||||
this.createDownloadMultiple({ list, type })
|
||||
this.removeAllSelect()
|
||||
this.isShowDownloadMultiple = false
|
||||
|
@ -420,6 +417,9 @@ export default {
|
|||
clipboardWriteText(str)
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
span.select {{item.albumName}}
|
||||
td(style="width: 15%; padding-left: 0; padding-right: 0;")
|
||||
material-list-buttons(:index="index" :remove-btn="false" :class="$style.listBtn"
|
||||
:play-btn="item.source == 'kw' || !isAPITemp"
|
||||
:download-btn="item.source == 'kw' || !isAPITemp"
|
||||
:play-btn="assertApiSupport(item.source)"
|
||||
:download-btn="assertApiSupport(item.source)"
|
||||
@btn-click="handleListBtnClick")
|
||||
td(style="width: 10%;")
|
||||
span(:class="[$style.time, $style.noSelect]") {{item.interval || '--/--'}}
|
||||
|
@ -53,14 +53,14 @@
|
|||
p {{$t('view.search.no_item')}}
|
||||
material-download-modal(:show="isShowDownload" :musicInfo="musicInfo" @select="handleAddDownload" @close="isShowDownload = false")
|
||||
material-download-multiple-modal(:show="isShowDownloadMultiple" :list="selectdData" @select="handleAddDownloadMultiple" @close="isShowDownloadMultiple = false")
|
||||
material-flow-btn(:show="isShowEditBtn && (searchSourceId == 'kw' || searchSourceId == 'all' || !isAPITemp)" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
material-flow-btn(:show="isShowEditBtn && (searchSourceId == 'all' || assertApiSupport(searchSourceId))" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
material-list-add-modal(:show="isShowListAdd" :musicInfo="musicInfo" @close="isShowListAdd = false")
|
||||
material-list-add-multiple-modal(:show="isShowListAddMultiple" :musicList="selectdData" @close="handleListAddModalClose")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { scrollTo, clipboardWriteText } from '../utils'
|
||||
import { scrollTo, clipboardWriteText, assertApiSupport } from '../utils'
|
||||
// import music from '../utils/music'
|
||||
export default {
|
||||
name: 'Search',
|
||||
|
@ -151,9 +151,6 @@ export default {
|
|||
listInfo() {
|
||||
return this.setting.search.searchSource == 'all' ? this.allList : this.sourceList[this.setting.search.searchSource]
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
hotSearchList() {
|
||||
return this.$store.getters['hotSearch/list'][this.setting.search.searchSource] || []
|
||||
},
|
||||
|
@ -303,7 +300,7 @@ export default {
|
|||
targetSong = this.selectdData[0]
|
||||
this.listAddMultiple({ id: 'default', list: this.filterList(this.selectdData) })
|
||||
} else {
|
||||
if (this.isAPITemp && this.listInfo.list[index].source != 'kw') return
|
||||
if (!this.assertApiSupport(this.listInfo.list[index].source)) return
|
||||
targetSong = this.listInfo.list[index]
|
||||
this.listAdd({ id: 'default', musicInfo: targetSong })
|
||||
}
|
||||
|
@ -353,7 +350,10 @@ export default {
|
|||
}
|
||||
},
|
||||
filterList(list) {
|
||||
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : [...list]
|
||||
return this.searchSourceId == 'all'
|
||||
? list.filter(s => this.assertApiSupport(s.source))
|
||||
: this.assertApiSupport(this.searchSourceId)
|
||||
? [...list] : []
|
||||
},
|
||||
handleListAddModalClose(isClearSelect) {
|
||||
if (isClearSelect) this.removeAllSelect()
|
||||
|
@ -383,6 +383,9 @@ export default {
|
|||
},
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
<script>
|
||||
import { mapGetters, mapMutations, mapActions } from 'vuex'
|
||||
import { scrollTo } from '../utils'
|
||||
import { scrollTo, assertApiSupport } from '../utils'
|
||||
// import music from '../utils/music'
|
||||
export default {
|
||||
name: 'SongList',
|
||||
|
@ -108,9 +108,6 @@ export default {
|
|||
}
|
||||
return list
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
tagList() {
|
||||
let tagInfo = this.tags[this.source]
|
||||
return tagInfo ? [{ name: '热门标签', list: [...tagInfo.hotTag] }, ...tagInfo.tags] : []
|
||||
|
@ -208,7 +205,7 @@ export default {
|
|||
this.resetSelect()
|
||||
} else {
|
||||
targetSong = this.listDetail.list[index]
|
||||
if (this.isAPITemp && targetSong.source != 'kw') return
|
||||
if (!this.assertApiSupport(targetSong.source)) return
|
||||
this.listAdd({ id: 'default', musicInfo: targetSong })
|
||||
}
|
||||
let targetIndex = this.defaultList.list.findIndex(
|
||||
|
@ -250,14 +247,7 @@ export default {
|
|||
this.isShowDownload = false
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
// case 'kg':
|
||||
case 'tx':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
case 'xm':
|
||||
if (type == 'flac') type = 'wav'
|
||||
}
|
||||
if (this.source == 'xm' && type == 'flac') type = 'wav'
|
||||
this.createDownloadMultiple({ list: this.filterList(this.selectdData), type })
|
||||
this.resetSelect()
|
||||
this.isShowDownloadMultiple = false
|
||||
|
@ -334,7 +324,7 @@ export default {
|
|||
this.handleGetListDetail(this.importSongListText, 1)
|
||||
},
|
||||
filterList(list) {
|
||||
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : [...list]
|
||||
return list.filter(s => this.assertApiSupport(s.source))
|
||||
},
|
||||
setTagListWidth() {
|
||||
this.isInitedTagListWidth = true
|
||||
|
@ -347,6 +337,9 @@ export default {
|
|||
return Promise.reject(err)
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
/* addSongListDetail() {
|
||||
// this.detailLoading = true
|
||||
// this.getListDetailAll(this.selectListInfo.id).then(() => {
|
||||
|
|
Loading…
Reference in New Issue