1
0
forked from um/web
web/src/decrypt/raw.js
2020-02-06 16:18:40 +08:00

20 lines
578 B
JavaScript

const musicMetadata = require("music-metadata-browser");
const util = require("./util");
export {Decrypt}
async function Decrypt(file, raw_filename, raw_ext) {
const tag = await musicMetadata.parseBlob(file);
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
return {
status: true,
title: info.title,
artist: info.artist,
ext: raw_ext,
album: tag.common.album,
picture: util.GetCoverURL(tag),
file: URL.createObjectURL(file),
mime: util.AudioMimeType[raw_ext]
}
}