添加对下载歌曲时封面图片大小的控制处理(#1609)
parent
c238d49584
commit
47635c95e1
|
@ -22,6 +22,7 @@
|
||||||
- 添加对wy源某些歌曲有问题的歌词进行修复
|
- 添加对wy源某些歌曲有问题的歌词进行修复
|
||||||
- 改进本地音乐在线信息的匹配机制
|
- 改进本地音乐在线信息的匹配机制
|
||||||
- 优化任务下载状态显示,现在下载时若数据传输完成但数据写入未完成时会显示相应的状态
|
- 优化任务下载状态显示,现在下载时若数据传输完成但数据写入未完成时会显示相应的状态
|
||||||
|
- 添加对下载歌曲时封面图片大小的控制处理(#1609)
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ const writeMeta = async(filePath, meta, picPath) => {
|
||||||
|
|
||||||
module.exports = (filePath, meta) => {
|
module.exports = (filePath, meta) => {
|
||||||
if (!meta.APIC) return writeMeta(filePath, meta)
|
if (!meta.APIC) return writeMeta(filePath, meta)
|
||||||
const picUrl = meta.APIC
|
let picUrl = meta.APIC
|
||||||
delete meta.APIC
|
delete meta.APIC
|
||||||
if (!/^http/.test(picUrl)) {
|
if (!/^http/.test(picUrl)) {
|
||||||
return writeMeta(filePath, meta)
|
return writeMeta(filePath, meta)
|
||||||
|
@ -67,6 +67,7 @@ module.exports = (filePath, meta) => {
|
||||||
let ext = path.extname(picUrl)
|
let ext = path.extname(picUrl)
|
||||||
let picPath = filePath.replace(/\.flac$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
let picPath = filePath.replace(/\.flac$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
||||||
|
|
||||||
|
if (picUrl.includes('music.126.net')) picUrl += `${picUrl.includes('?') ? '&' : '?'}param=500y500`
|
||||||
download(picUrl, picPath).then(success => {
|
download(picUrl, picPath).then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
writeMeta(filePath, meta, picPath).finally(() => {
|
writeMeta(filePath, meta, picPath).finally(() => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const NodeID3 = require('node-id3')
|
const NodeID3 = require('node-id3')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
// const fs = require('fs')
|
||||||
const download = require('./downloader')
|
const download = require('./downloader')
|
||||||
const extReg = /^(\.(?:jpe?g|png)).*$/
|
const extReg = /^(\.(?:jpe?g|png)).*$/
|
||||||
|
|
||||||
|
@ -23,13 +23,16 @@ module.exports = (filePath, meta) => {
|
||||||
}
|
}
|
||||||
let ext = path.extname(meta.APIC)
|
let ext = path.extname(meta.APIC)
|
||||||
let picPath = filePath.replace(/\.mp3$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
let picPath = filePath.replace(/\.mp3$/, '') + (ext ? ext.replace(extReg, '$1') : '.jpg')
|
||||||
download(meta.APIC, picPath).then(success => {
|
|
||||||
|
let picUrl = meta.APIC
|
||||||
|
if (picUrl.includes('music.126.net')) picUrl += `${picUrl.includes('?') ? '&' : '?'}param=500y500`
|
||||||
|
download(picUrl, picPath).then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
meta.APIC = picPath
|
meta.APIC = picPath
|
||||||
handleWriteMeta(meta, filePath)
|
handleWriteMeta(meta, filePath)
|
||||||
fs.unlink(picPath, err => {
|
// fs.unlink(picPath, err => {
|
||||||
if (err) console.log(err.message)
|
// if (err) console.log(err.message)
|
||||||
})
|
// })
|
||||||
} else {
|
} else {
|
||||||
delete meta.APIC
|
delete meta.APIC
|
||||||
handleWriteMeta(meta, filePath)
|
handleWriteMeta(meta, filePath)
|
||||||
|
|
Loading…
Reference in New Issue