From 9b28676c43bece3b900b38620b769f6962f9bc79 Mon Sep 17 00:00:00 2001 From: MengYX Date: Mon, 3 Aug 2020 14:03:10 +0800 Subject: [PATCH] Clean up --- README.md | 2 +- src/decrypt/qmc.js | 2 +- src/decrypt/util.js | 21 ++------------------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a5829d7..7b74d81 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Unlock Music 音乐解锁 -- 在浏览器中解锁加密的音乐文件。 Unlock encrypted music file in browser. +- 在浏览器中解锁加密的音乐文件。 Unlock encrypted music file in the browser. - unlock-music项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循[License](https://github.com/ix64/unlock-music/blob/master/LICENSE) - Unlock Music的CLI版本正在开发中。 - 我们新建了Telegram群组,欢迎加入![https://t.me/unlock_music_chat](https://t.me/unlock_music_chat) diff --git a/src/decrypt/qmc.js b/src/decrypt/qmc.js index 104e5f3..f4d66fd 100644 --- a/src/decrypt/qmc.js +++ b/src/decrypt/qmc.js @@ -60,7 +60,7 @@ export async function Decrypt(file, raw_filename, raw_ext) { const musicMeta = await musicMetadata.parseBlob(musicBlob); for (let metaIdx in musicMeta.native) { if (musicMeta.native[metaIdx].some(item => item.id === "TCON" && item.value === "(12)")) { - console.log("The metadata is using gbk encoding") + console.warn("The metadata is using gbk encoding") musicMeta.common.artist = decode(musicMeta.common.artist, "gbk"); musicMeta.common.title = decode(musicMeta.common.title, "gbk"); musicMeta.common.album = decode(musicMeta.common.album, "gbk"); diff --git a/src/decrypt/util.js b/src/decrypt/util.js index 8139b68..8d3875c 100644 --- a/src/decrypt/util.js +++ b/src/decrypt/util.js @@ -85,11 +85,11 @@ export async function GetWebImage(pic_url) { let buf = await resp.arrayBuffer(); let objBlob = new Blob([buf], {type: mime}); let objUrl = URL.createObjectURL(objBlob); - return {"buffer": buf, "url": objUrl, "type": mime}; + return {"buffer": buf, "src": pic_url, "url": objUrl, "type": mime}; } } catch (e) { } - return {"buffer": null, "url": "", "type": ""} + return {"buffer": null, "src": pic_url, "url": "", "type": ""} } export function WriteMp3Meta(audioData, artistList, title, album, pictureData = null, pictureDesc = "Cover") { @@ -108,20 +108,3 @@ export function WriteMp3Meta(audioData, artistList, title, album, pictureData = return writer.arrayBuffer; } -export function RequestJsonp(url, callback_name = "callback") { - return new Promise((resolve, reject) => { - let node; - window[callback_name] = function (data) { - delete window[callback_name]; - if (node.parentNode) node.parentNode.removeChild(node); - resolve(data) - }; - node = document.createElement('script'); - node.type = "text/javascript"; - node.src = url; - node.addEventListener('error', msg => { - reject(msg); - }); - document.head.appendChild(node); - }); -}