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