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) {
|
2020-02-06 08:18:40 +00:00
|
|
|
const tag = await musicMetadata.parseBlob(file);
|
|
|
|
const info = util.GetFileInfo(tag.common.artist, tag.common.title, raw_filename);
|
2020-01-21 11:03:41 +00:00
|
|
|
return {
|
|
|
|
status: true,
|
|
|
|
title: info.title,
|
|
|
|
artist: info.artist,
|
2020-02-04 10:24:53 +00:00
|
|
|
ext: raw_ext,
|
2020-01-21 11:03:41 +00:00
|
|
|
album: tag.common.album,
|
2020-02-06 08:18:40 +00:00
|
|
|
picture: util.GetCoverURL(tag),
|
|
|
|
file: URL.createObjectURL(file),
|
|
|
|
mime: util.AudioMimeType[raw_ext]
|
2020-01-21 11:03:41 +00:00
|
|
|
}
|
|
|
|
}
|