From ff74170bf2e3883ffe2382ef76717926a7f32dbd Mon Sep 17 00:00:00 2001 From: binaryify Date: Sun, 20 Mar 2022 15:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=91=E7=9B=98=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=8E=A5=E5=8F=A3=E9=83=A8=E5=88=86=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E6=A0=BC=E5=BC=8F=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/cloud.js | 8 ++++++-- plugins/songUpload.js | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/module/cloud.js b/module/cloud.js index f988e3d..2f657f2 100644 --- a/module/cloud.js +++ b/module/cloud.js @@ -6,6 +6,10 @@ module.exports = async (query, request) => { if (query.songFile.name.indexOf('flac') > -1) { ext = 'flac' } + const filename = query.songFile.name + .replace('.' + ext, '') + .replaceAll(' ', '_') + .replaceAll('.', '_') query.cookie.os = 'pc' query.cookie.appver = '2.9.7' const bitrate = 999000 @@ -89,7 +93,7 @@ module.exports = async (query, request) => { { bucket: '', ext: ext, - filename: query.songFile.name.replace('.' + ext, ''), + filename: filename, local: false, nos_product: 3, type: 'audio', @@ -110,7 +114,7 @@ module.exports = async (query, request) => { md5: query.songFile.md5, songid: res.body.songId, filename: query.songFile.name, - song: songName || query.songFile.name.replace('.mp3', ''), + song: songName || filename, album: album || '未知专辑', artist: artist || '未知艺术家', bitrate: String(bitrate), diff --git a/plugins/songUpload.js b/plugins/songUpload.js index 0723c38..8a9716e 100644 --- a/plugins/songUpload.js +++ b/plugins/songUpload.js @@ -4,6 +4,10 @@ module.exports = async (query, request) => { if (query.songFile.name.indexOf('flac') > -1) { ext = 'flac' } + const filename = query.songFile.name + .replace('.' + ext, '') + .replaceAll(' ', '_') + .replaceAll('.', '_') // 获取key和token const tokenRes = await request( 'POST', @@ -11,7 +15,7 @@ module.exports = async (query, request) => { { bucket: 'jd-musicrep-privatecloud-audio-public', ext: ext, - filename: query.songFile.name.replace('.' + ext, ''), + filename: filename, local: false, nos_product: 3, type: 'audio',