1
0
forked from um/web

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

View File

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