新增酷我歌单显示歌曲文件大小

pull/277/head
lyswhut 2020-05-10 18:55:20 +08:00
parent 8605f63ac6
commit 10ee6bcc7f
1 changed files with 33 additions and 19 deletions

View File

@ -21,6 +21,7 @@ export default {
}, },
], ],
regExps: { regExps: {
mInfo: /bitrate:(\d+),format:(\w+),size:([\w.]+)/,
// http://www.kuwo.cn/playlist_detail/2886046289 // http://www.kuwo.cn/playlist_detail/2886046289
// https://m.kuwo.cn/h5app/playlist/2736267853?t=qqfriend // https://m.kuwo.cn/h5app/playlist/2736267853?t=qqfriend
listDetailLink: /^.+\/playlist(?:_detail)?\/(\d+)(?:\?.*|&.*$|#.*$|$)/, listDetailLink: /^.+\/playlist(?:_detail)?\/(\d+)(?:\?.*|&.*$|#.*$|$)/,
@ -189,29 +190,42 @@ export default {
}) })
}, },
filterListDetail(rawData) { filterListDetail(rawData) {
// console.log(rawList) // console.log(rawData)
return rawData.map((item, inedx) => { return rawData.map(item => {
let formats = item.formats.split('|') let infoArr = item.MINFO.split(';')
let types = [] let types = []
let _types = {} let _types = {}
if (formats.includes('MP3128')) { for (let info of infoArr) {
types.push({ type: '128k', size: null }) info = info.match(this.regExps.mInfo)
_types['128k'] = { if (info) {
size: null, switch (info[2]) {
} case 'flac':
} types.push({ type: 'flac', size: info[3] })
if (formats.includes('MP3H')) {
types.push({ type: '320k', size: null })
_types['320k'] = {
size: null,
}
}
if (formats.includes('ALFLAC')) {
types.push({ type: 'flac', size: null })
_types.flac = { _types.flac = {
size: null, size: info[3].toLocaleUpperCase(),
}
break
case 'mp3':
switch (info[1]) {
case '320':
types.push({ type: '320k', size: info[3] })
_types['320k'] = {
size: info[3].toLocaleUpperCase(),
}
break
case '192':
case '128':
types.push({ type: '128k', size: info[3] })
_types['128k'] = {
size: info[3].toLocaleUpperCase(),
}
break
}
break
} }
} }
}
types.reverse()
return { return {
singer: formatSinger(decodeName(item.artist)), singer: formatSinger(decodeName(item.artist)),