Write meta for qq music mp3

This commit is contained in:
MengYX 2020-07-18 18:48:07 +08:00
parent 6b1c08663a
commit e2d4283003
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604
1 changed files with 5 additions and 2 deletions

View File

@ -76,12 +76,14 @@ export async function Decrypt(file, raw_filename, raw_ext) {
if (imageInfo.url !== "") {
imgUrl = imageInfo.url
if (ext === "mp3") {
let writer = new ID3Writer(audioData)
let writer = new ID3Writer(musicDecoded)
writer.setFrame('APIC', {
type: 3,
data: imageInfo.buffer,
description: "Cover",
})
writer.addTag();
musicDecoded = writer.arrayBuffer
musicBlob = new Blob([musicDecoded], {type: mime});
}
}
@ -133,11 +135,12 @@ async function queryAlbumCoverImage(artist, title, album) {
jsonpData = await RequestJsonp(song_query_url, "callback");
queriedSong = jsonpData["data"]["song"]["list"][0];
} catch (e) {
console.log(e)
}
let imgUrl = "";
if (!!queriedSong && !!queriedSong["album"]) {
if (queriedSong["album"]["pmid"] !== undefined) {
imgUrl = "https://stats.ixarea.com/collect/qq-cover/1/" + queriedSong["album"]["pmid"]
imgUrl = "https://stats.ixarea.com/collect/music/qq-cover/1/" + queriedSong["album"]["pmid"]
} else if (queriedSong["album"]["id"] !== undefined) {
imgUrl = "https://stats.ixarea.com/collect/music/qq-cover/2/" + queriedSong["album"]["id"]
}