|
|
@ -1,13 +1,5 @@ |
|
|
|
const ID3Writer = require("browser-id3-writer"); |
|
|
|
export const FLAC_HEADER = [0x66, 0x4C, 0x61, 0x43]; |
|
|
|
export const MP3_HEADER = [0x49, 0x44, 0x33]; |
|
|
|
export const OGG_HEADER = [0x4F, 0x67, 0x67, 0x53]; |
|
|
|
export const M4A_HEADER = [0x66, 0x74, 0x79, 0x70]; |
|
|
|
export const WMA_HEADER = [ |
|
|
|
0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, |
|
|
|
0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C, |
|
|
|
] |
|
|
|
export const WAV_HEADER = [0x52, 0x49, 0x46, 0x46] |
|
|
|
|
|
|
|
export const AudioMimeType = { |
|
|
|
mp3: "audio/mpeg", |
|
|
|
flac: "audio/flac", |
|
|
@ -18,16 +10,6 @@ export const AudioMimeType = { |
|
|
|
}; |
|
|
|
export const IXAREA_API_ENDPOINT = "https://stats.ixarea.com/apis" |
|
|
|
|
|
|
|
// Also a new draft API: blob.arrayBuffer()
|
|
|
|
export async function GetArrayBuffer(blobObject) { |
|
|
|
return await new Promise(resolve => { |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onload = (e) => { |
|
|
|
resolve(e.target.result); |
|
|
|
}; |
|
|
|
reader.readAsArrayBuffer(blobObject); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
export function GetFileInfo(artist, title, filenameNoExt, separator = "-") { |
|
|
|
let newArtist = "", newTitle = ""; |
|
|
@ -56,13 +38,6 @@ export function GetMetaCoverURL(metadata) { |
|
|
|
return pic_url; |
|
|
|
} |
|
|
|
|
|
|
|
export function IsBytesEqual(first, second) { |
|
|
|
// if want wholly check, should length first>=second
|
|
|
|
return first.every((val, idx) => { |
|
|
|
return val === second[idx]; |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export async function GetWebImage(pic_url) { |
|
|
|
try { |
|
|
|