开放腾讯源128k音源直接播放

pull/96/head
lyswhut 2019-09-30 15:24:00 +08:00
parent bac9439f8e
commit 6d7be78b70
7 changed files with 17 additions and 15 deletions

View File

@ -5,7 +5,7 @@ material-modal(:show="show" :bg-close="bgClose" @close="handleClose")
| {{ info.name }} | {{ info.name }}
br br
| {{ info.singer }} | {{ info.singer }}
material-btn(:class="$style.btn" :title="!checkSource(type.type) && '目前酷狗音源仅支持下载128k音质'" :disabled="!checkSource(type.type)" :key="type.type" @click="handleClick(type.type)" v-for="type in info.types") {{getTypeName(type.type)}} {{ type.type.toUpperCase() }}{{ type.size && ` - ${type.size.toUpperCase()}` }} material-btn(:class="$style.btn" :title="!checkSource(type.type) && '目前腾讯、酷狗音源仅支持下载128k音质'" :disabled="!checkSource(type.type)" :key="type.type" @click="handleClick(type.type)" v-for="type in info.types") {{getTypeName(type.type)}} {{ type.type.toUpperCase() }}{{ type.size && ` - ${type.size.toUpperCase()}` }}
</template> </template>
@ -53,6 +53,7 @@ export default {
switch (this.musicInfo.source) { switch (this.musicInfo.source) {
case 'wy': case 'wy':
case 'kg': case 'kg':
case 'tx':
return type == '128k' return type == '128k'
default: default:

View File

@ -27,7 +27,7 @@ div(:class="$style.songList")
td.break(style="width: 20%;") {{item.singer}} td.break(style="width: 20%;") {{item.singer}}
td.break(style="width: 22%;") {{item.albumName}} td.break(style="width: 22%;") {{item.albumName}}
td(style="width: 18%;") td(style="width: 18%;")
material-list-buttons(:index="index" :search-btn="true" :play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :remove-btn="false" @btn-click="handleListBtnClick") material-list-buttons(:index="index" :search-btn="true" :play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'wy')" :download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'wy')" :remove-btn="false" @btn-click="handleListBtnClick")
//- 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-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-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)') //- button.btn-success(type='button' v-if="(item._types['128k'] || item._types['192k'] || item._types['320k']) && userInfo" @click.stop='showListModal(index)')
@ -136,7 +136,7 @@ export default {
this.clickIndex = index this.clickIndex = index
return return
} }
this.emitEvent((this.source == 'kw' || (!this.isAPITemp && this.list[index].source != 'tx' && this.list[index].source != 'wy')) ? 'testPlay' : 'search', index) this.emitEvent((this.source == 'kw' || (!this.isAPITemp && this.list[index].source != 'wy')) ? 'testPlay' : 'search', index)
this.clickTime = 0 this.clickTime = 0
this.clickIndex = -1 this.clickIndex = -1
}, },

View File

@ -1,6 +1,6 @@
import kw_api_temp from './kw/api-temp' import kw_api_temp from './kw/api-temp'
import kw_api_test from './kw/api-test' import kw_api_test from './kw/api-test'
// import tx_api_messoer from './tx/api-messoer' import tx_api_test from './tx/api-test'
import kg_api_test from './kg/api-test' import kg_api_test from './kg/api-test'
import wy_api_test from './wy/api-test' import wy_api_test from './wy/api-test'
import bd_api_test from './bd/api-test' import bd_api_test from './bd/api-test'
@ -12,7 +12,7 @@ import bd_api_test from './bd/api-test'
const apis = { const apis = {
kw_api_test, kw_api_test,
// tx_api_messoer, tx_api_test,
kg_api_test, kg_api_test,
wy_api_test, wy_api_test,
bd_api_test, bd_api_test,

View File

@ -1,10 +1,10 @@
import { httpFetch } from '../../request' import { httpFetch } from '../../request'
import { requestMsg } from '../../message' import { requestMsg } from '../../message'
import { headers, timeout } from '../messoer' import { headers, timeout } from '../options'
const api_messoer = { const api_messoer = {
getMusicUrl(songInfo, type) { getMusicUrl(songInfo, type) {
const requestObj = httpFetch(`https://v1.itooi.cn/tencent/url?id=${songInfo.strMediaMid}&quality=${type.replace(/k$/, '')}`, { const requestObj = httpFetch(`http://ts.tempmusic.tk/url/tx/${songInfo.strMediaMid}/${type}`, {
method: 'get', method: 'get',
timeout, timeout,
headers, headers,

View File

@ -9,6 +9,7 @@ export const getMusicType = (info, type) => {
switch (window.globalObj.apiSource) { switch (window.globalObj.apiSource) {
case 'kg': case 'kg':
case 'wy': case 'wy':
case 'tx':
return '128k' return '128k'
} }
const rangeType = types.slice(types.indexOf(type)) const rangeType = types.slice(types.indexOf(type))

View File

@ -18,7 +18,7 @@
table table
tbody tbody
tr(v-for='(item, index) in list' :key='item.songmid' tr(v-for='(item, index) in list' :key='item.songmid'
@click="handleDoubleClick(index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') || item.source == 'tx' || item.source == 'wy' ? $style.disabled : '']") @click="handleDoubleClick(index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') || item.source == 'wy' ? $style.disabled : '']")
td.nobreak.center(style="width: 37px;" @click.stop) td.nobreak.center(style="width: 37px;" @click.stop)
material-checkbox(:id="index.toString()" v-model="selectdData" :value="item") material-checkbox(:id="index.toString()" v-model="selectdData" :value="item")
td.break(style="width: 25%;") {{item.name}} td.break(style="width: 25%;") {{item.name}}
@ -167,7 +167,7 @@ export default {
this.clickIndex = -1 this.clickIndex = -1
}, },
testPlay(index) { testPlay(index) {
if ((this.isAPITemp && this.list[index].source != 'kw') || this.list[index].source == 'tx' || this.list[index].source == 'wy') return if ((this.isAPITemp && this.list[index].source != 'kw') || this.list[index].source == 'wy') return
this.setList({ list: this.list, listId: 'test', index }) this.setList({ list: this.list, listId: 'test', index })
}, },
handleRemove(index) { handleRemove(index) {
@ -177,7 +177,7 @@ export default {
switch (info.action) { switch (info.action) {
case 'download': { case 'download': {
const minfo = this.list[info.index] const minfo = this.list[info.index]
if ((this.isAPITemp && minfo.source != 'kw') || minfo.source == 'tx' || minfo.source == 'wy') return if ((this.isAPITemp && minfo.source != 'kw') || minfo.source == 'wy') return
this.musicInfo = minfo this.musicInfo = minfo
this.$nextTick(() => { this.$nextTick(() => {
this.isShowDownload = true this.isShowDownload = true
@ -204,7 +204,7 @@ export default {
this.selectdData = [] this.selectdData = []
}, },
handleAddDownloadMultiple(type) { handleAddDownloadMultiple(type) {
const list = this.setting.apiSource == 'temp' ? this.selectdData.filter(s => s.source == 'kw') : this.selectdData.filter(s => s.source != 'tx' && s.source != 'wy') const list = this.setting.apiSource == 'temp' ? this.selectdData.filter(s => s.source == 'kw') : this.selectdData.filter(s => s.source != 'wy')
this.createDownloadMultiple({ list, type }) this.createDownloadMultiple({ list, type })
this.resetSelect() this.resetSelect()
this.isShowDownloadMultiple = false this.isShowDownloadMultiple = false

View File

@ -30,8 +30,8 @@
td.break(style="width: 25%;") {{item.albumName}} td.break(style="width: 25%;") {{item.albumName}}
td(style="width: 15%;") td(style="width: 15%;")
material-list-buttons(:index="index" :remove-btn="false" :class="$style.listBtn" material-list-buttons(:index="index" :remove-btn="false" :class="$style.listBtn"
:play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'wy')"
:download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'wy')"
@btn-click="handleListBtnClick") @btn-click="handleListBtnClick")
td(style="width: 10%;") {{item.interval}} td(style="width: 10%;") {{item.interval}}
div(:class="$style.pagination") div(:class="$style.pagination")
@ -174,7 +174,7 @@ export default {
targetSong = this.selectdData[0] targetSong = this.selectdData[0]
this.defaultListAddMultiple(this.filterList(this.selectdData)) this.defaultListAddMultiple(this.filterList(this.selectdData))
} else { } else {
if ((this.isAPITemp && this.listInfo.list[index].source != 'kw') || this.listInfo.list[index].source == 'tx' || this.listInfo.list[index].source == 'wy') return if ((this.isAPITemp && this.listInfo.list[index].source != 'kw') || this.listInfo.list[index].source == 'wy') return
targetSong = this.listInfo.list[index] targetSong = this.listInfo.list[index]
this.defaultListAdd(targetSong) this.defaultListAdd(targetSong)
} }
@ -224,7 +224,7 @@ export default {
} }
}, },
filterList(list) { filterList(list) {
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : list.filter(s => s.source != 'tx' && s.source != 'wy') return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : list.filter(s => s.source != 'wy')
}, },
}, },
} }