|
@ -1,18 +1,9 @@ |
|
|
import { |
|
|
import {AudioMimeType, DetectAudioExt, GetArrayBuffer, GetFileInfo, GetMetaCoverURL, GetWebImage} from "./util"; |
|
|
AudioMimeType, |
|
|
|
|
|
DetectAudioExt, |
|
|
|
|
|
GetArrayBuffer, |
|
|
|
|
|
GetFileInfo, |
|
|
|
|
|
GetMetaCoverURL, |
|
|
|
|
|
GetWebImage, |
|
|
|
|
|
RequestJsonp |
|
|
|
|
|
} from "./util"; |
|
|
|
|
|
|
|
|
|
|
|
const MetaFlac = require('metaflac-js'); |
|
|
|
|
|
|
|
|
|
|
|
import {QmcMaskCreate58, QmcMaskDetectMflac, QmcMaskDetectMgg, QmcMaskGetDefault} from "./qmcMask"; |
|
|
import {QmcMaskCreate58, QmcMaskDetectMflac, QmcMaskDetectMgg, QmcMaskGetDefault} from "./qmcMask"; |
|
|
import {fromByteArray as Base64Encode, toByteArray as Base64Decode} from 'base64-js' |
|
|
import {fromByteArray as Base64Encode, toByteArray as Base64Decode} from 'base64-js' |
|
|
|
|
|
|
|
|
|
|
|
const MetaFlac = require('metaflac-js'); |
|
|
|
|
|
|
|
|
const ID3Writer = require("browser-id3-writer"); |
|
|
const ID3Writer = require("browser-id3-writer"); |
|
|
|
|
|
|
|
|
const iconv = require('iconv-lite'); |
|
|
const iconv = require('iconv-lite'); |
|
@ -135,23 +126,21 @@ async function queryKeyInfo(keyData, filename, format) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function queryAlbumCoverImage(artist, title, album) { |
|
|
async function queryAlbumCoverImage(artist, title, album) { |
|
|
let song_query_url = "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?n=10&new_json=1&w=" + |
|
|
//https://stats.ixarea.com/collect
|
|
|
encodeURIComponent(artist + " " + title + " " + album); |
|
|
const song_query_url = "http://localhost:6580/music/qq-cover" |
|
|
let jsonpData; |
|
|
|
|
|
let queriedSong = undefined; |
|
|
|
|
|
try { |
|
|
try { |
|
|
jsonpData = await RequestJsonp(song_query_url, "callback"); |
|
|
const resp = await fetch(song_query_url, { |
|
|
queriedSong = jsonpData["data"]["song"]["list"][0]; |
|
|
method: "POST", |
|
|
} catch (e) { |
|
|
headers: {"Content-Type": "application/json"}, |
|
|
console.log(e) |
|
|
body: JSON.stringify({Artist: artist, Title: title, Album: album}), |
|
|
} |
|
|
}) |
|
|
let imgUrl = ""; |
|
|
if (resp.ok) { |
|
|
if (!!queriedSong && !!queriedSong["album"]) { |
|
|
let data = await resp.json(); |
|
|
if (queriedSong["album"]["pmid"] !== undefined) { |
|
|
return song_query_url + "/" + data.Type + "/" + data.Id |
|
|
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"] |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.log(e); |
|
|
} |
|
|
} |
|
|
return imgUrl; |
|
|
return ""; |
|
|
} |
|
|
} |
|
|