Clean up
This commit is contained in:
parent
4a2d31238b
commit
9b28676c43
@ -1,5 +1,5 @@
|
|||||||
# Unlock Music 音乐解锁
|
# 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项目是以学习和技术研究的初衷创建的,修改、再分发时请遵循[License](https://github.com/ix64/unlock-music/blob/master/LICENSE)
|
||||||
- Unlock Music的CLI版本正在开发中。
|
- Unlock Music的CLI版本正在开发中。
|
||||||
- 我们新建了Telegram群组,欢迎加入![https://t.me/unlock_music_chat](https://t.me/unlock_music_chat)
|
- 我们新建了Telegram群组,欢迎加入![https://t.me/unlock_music_chat](https://t.me/unlock_music_chat)
|
||||||
|
@ -60,7 +60,7 @@ export async function Decrypt(file, raw_filename, raw_ext) {
|
|||||||
const musicMeta = await musicMetadata.parseBlob(musicBlob);
|
const musicMeta = await musicMetadata.parseBlob(musicBlob);
|
||||||
for (let metaIdx in musicMeta.native) {
|
for (let metaIdx in musicMeta.native) {
|
||||||
if (musicMeta.native[metaIdx].some(item => item.id === "TCON" && item.value === "(12)")) {
|
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.artist = decode(musicMeta.common.artist, "gbk");
|
||||||
musicMeta.common.title = decode(musicMeta.common.title, "gbk");
|
musicMeta.common.title = decode(musicMeta.common.title, "gbk");
|
||||||
musicMeta.common.album = decode(musicMeta.common.album, "gbk");
|
musicMeta.common.album = decode(musicMeta.common.album, "gbk");
|
||||||
|
@ -85,11 +85,11 @@ export async function GetWebImage(pic_url) {
|
|||||||
let buf = await resp.arrayBuffer();
|
let buf = await resp.arrayBuffer();
|
||||||
let objBlob = new Blob([buf], {type: mime});
|
let objBlob = new Blob([buf], {type: mime});
|
||||||
let objUrl = URL.createObjectURL(objBlob);
|
let objUrl = URL.createObjectURL(objBlob);
|
||||||
return {"buffer": buf, "url": objUrl, "type": mime};
|
return {"buffer": buf, "src": pic_url, "url": objUrl, "type": mime};
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} 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") {
|
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;
|
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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user