1
0
forked from um/web
web/src/decrypt/raw.js

26 lines
676 B
JavaScript
Raw Normal View History

2020-01-21 11:03:41 +00:00
const musicMetadata = require("music-metadata-browser");
const util = require("./util");
export {Decrypt}
async function Decrypt(file, raw_filename, raw_ext) {
let tag = await musicMetadata.parseBlob(file);
let fileUrl = URL.createObjectURL(file);
const picUrl = util.GetCoverURL(tag);
const mime = util.AudioMimeType[raw_ext];
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename, raw_ext);
return {
status: true,
filename: info.filename,
title: info.title,
artist: info.artist,
album: tag.common.album,
picture: picUrl,
file: fileUrl,
mime: mime
}
}