改变排行榜布局,新增更多排行榜
This commit is contained in:
@@ -16,7 +16,7 @@ electronDebug({
|
||||
// Install `vue-devtools`
|
||||
electron.app.on('ready', () => {
|
||||
installExtension(VUEJS_DEVTOOLS)
|
||||
.then(name => console.log(`Added Extension: ${name}`))
|
||||
.then(info => console.log(`Added Extension: ${info.name}`))
|
||||
.catch(err => console.log('An error occurred: ', err))
|
||||
})
|
||||
|
||||
|
||||
@@ -15,3 +15,5 @@ require('./tray')
|
||||
require('./updateSetting')
|
||||
|
||||
require('./xm_verify')
|
||||
|
||||
require('./kw_decodeLyric')
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
const { inflate } = require('zlib')
|
||||
const iconv = require('iconv-lite')
|
||||
const { mainHandle } = require('../../common/ipc')
|
||||
|
||||
const handleInflate = data => new Promise((resolve, reject) => {
|
||||
inflate(data, (err, result) => {
|
||||
if (err) return reject(err)
|
||||
resolve(result)
|
||||
})
|
||||
})
|
||||
|
||||
const buf_key = Buffer.from('yeelion')
|
||||
const buf_key_len = buf_key.length
|
||||
|
||||
const decodeLyric = async(buf, isGetLyricx) => {
|
||||
// const info = buf.slice(0, index).toString()
|
||||
// if (!info.startsWith('tp=content')) return null
|
||||
// const isLyric = info.includes('\r\nlrcx=0\r\n')
|
||||
if (buf.toString('utf8', 0, 10) != 'tp=content') return ''
|
||||
// const index = buf.indexOf('\r\n\r\n') + 4
|
||||
const lrcData = await handleInflate(buf.slice(buf.indexOf('\r\n\r\n') + 4))
|
||||
|
||||
if (!isGetLyricx) return iconv.decode(lrcData, 'gb18030')
|
||||
|
||||
const buf_str = Buffer.from(lrcData.toString(), 'base64')
|
||||
const buf_str_len = buf_str.length
|
||||
const output = new Uint16Array(buf_str_len)
|
||||
let i = 0
|
||||
while (i < buf_str_len) {
|
||||
let j = 0
|
||||
while (j < buf_key_len && i < buf_str_len) {
|
||||
output[i] = buf_str[i] ^ buf_key[j]
|
||||
i++
|
||||
j++
|
||||
}
|
||||
}
|
||||
|
||||
return iconv.decode(Buffer.from(output), 'gb18030')
|
||||
}
|
||||
|
||||
mainHandle('kw_decodeLyric', async(event, { lrcBase64, isGetLyricx }) => {
|
||||
if (!global.mainWindow) throw new Error('mainwindow is undefined')
|
||||
const lrc = await decodeLyric(Buffer.from(lrcBase64, 'base64'), isGetLyricx)
|
||||
return Buffer.from(lrc).toString('base64')
|
||||
})
|
||||
@@ -64,7 +64,8 @@ module.exports = (filePath, meta) => {
|
||||
if (!/^http/.test(picUrl)) {
|
||||
return writeMeta(filePath, meta)
|
||||
}
|
||||
let picPath = filePath.replace(/\.flac$/, '') + path.extname(picUrl).replace(extReg, '$1')
|
||||
let ext = path.extname(picUrl)
|
||||
let picPath = filePath.replace(/\.flac$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
||||
|
||||
request(picUrl)
|
||||
.on('response', respones => {
|
||||
|
||||
@@ -10,7 +10,8 @@ module.exports = (filePath, meta) => {
|
||||
delete meta.APIC
|
||||
return NodeID3.write(meta, filePath)
|
||||
}
|
||||
let picPath = filePath.replace(/\.mp3$/, '') + path.extname(meta.APIC).replace(extReg, '$1')
|
||||
let ext = path.extname(meta.APIC)
|
||||
let picPath = filePath.replace(/\.mp3$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
||||
request(meta.APIC)
|
||||
.on('response', respones => {
|
||||
if (respones.statusCode !== 200 && respones.statusCode != 206) {
|
||||
|
||||
Reference in New Issue
Block a user