This commit is contained in:
MengYX 2020-08-03 14:03:10 +08:00
parent 4a2d31238b
commit 9b28676c43
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604
3 changed files with 4 additions and 21 deletions

View File

@ -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)

View File

@ -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");

View File

@ -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);
});
}