From 31215772e3a89b6049138afb91c525525f5810ff Mon Sep 17 00:00:00 2001 From: MengYX Date: Sun, 6 Dec 2020 02:16:45 +0800 Subject: [PATCH 1/2] Try to fix .qmc ID3 Info --- src/decrypt/qmc.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/decrypt/qmc.js b/src/decrypt/qmc.js index f1cc265..8d2c7a5 100644 --- a/src/decrypt/qmc.js +++ b/src/decrypt/qmc.js @@ -5,7 +5,8 @@ import { GetFileInfo, GetMetaCoverURL, GetWebImage, - IXAREA_API_ENDPOINT + IXAREA_API_ENDPOINT, + WriteMp3Meta } from "./util"; import {QmcMaskCreate58, QmcMaskDetectMflac, QmcMaskDetectMgg, QmcMaskGetDefault} from "./qmcMask"; import {fromByteArray as Base64Encode, toByteArray as Base64Decode} from 'base64-js' @@ -85,14 +86,9 @@ export async function Decrypt(file, raw_filename, raw_ext) { imgUrl = imageInfo.url try { if (ext === "mp3") { - let writer = new ID3Writer(musicDecoded) - writer.setFrame('APIC', { - type: 3, - data: imageInfo.buffer, - description: "Cover", - }) - writer.addTag(); - musicDecoded = writer.arrayBuffer + musicDecoded = await WriteMp3Meta(musicDecoded, + info.artist.split(" _ "), info.title, "", + imageInfo.buffer, "Cover", musicMeta) musicBlob = new Blob([musicDecoded], {type: mime}); } else if (ext === 'flac') { const writer = new MetaFlac(Buffer.from(musicDecoded)) From e1505148c8ad2161b72fe2a23515395643c5d883 Mon Sep 17 00:00:00 2001 From: MengYX Date: Sun, 6 Dec 2020 02:32:57 +0800 Subject: [PATCH 2/2] Add tips for qmc not writing cover --- src/decrypt/qmc.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/decrypt/qmc.js b/src/decrypt/qmc.js index 8d2c7a5..8b8f8d4 100644 --- a/src/decrypt/qmc.js +++ b/src/decrypt/qmc.js @@ -95,6 +95,8 @@ export async function Decrypt(file, raw_filename, raw_ext) { writer.importPictureFromBuffer(Buffer.from(imageInfo.buffer)) musicDecoded = writer.save() musicBlob = new Blob([musicDecoded], {type: mime}); + } else { + console.info("writing metadata for " + ext + " is not being supported for now") } } catch (e) { console.warn("Error while appending cover image to file " + e)