1
0
forked from um/web

Remove iconv-lite calling

This commit is contained in:
Yuki1536 2022-12-11 18:22:47 +09:00
parent f6dd6935cd
commit a1b703a701

View File

@ -1,6 +1,5 @@
import { parseBlob as metaParseBlob } from 'music-metadata-browser'; import { parseBlob as metaParseBlob } from 'music-metadata-browser';
import { AudioMimeType, SniffAudioExt, GetArrayBuffer, GetMetaFromFile } from "./utils"; import { AudioMimeType, SniffAudioExt, GetArrayBuffer, GetMetaFromFile } from "./utils";
import { decode } from 'iconv-lite';
import { DecryptResult } from '@/decrypt/entity'; import { DecryptResult } from '@/decrypt/entity';
interface Handler { interface Handler {
@ -24,13 +23,6 @@ export async function Decrypt(file: File, raw_filename: string, raw_ext: string)
let musicBlob = new Blob([musicDecoded], { type: mime }); let musicBlob = new Blob([musicDecoded], { type: mime });
const musicMeta = await metaParseBlob(musicBlob); const musicMeta = await metaParseBlob(musicBlob);
for (let metaIdx in musicMeta.native) {
if (musicMeta.native[metaIdx].some(item => item.id === "TCON" && item.value === "(12)")) {
musicMeta.common.artist = decode(musicMeta.common.artist, "gbk");
musicMeta.common.title = decode(musicMeta.common.title, "gbk");
musicMeta.common.album = decode(musicMeta.common.album, "gbk");
}
}
const info = GetMetaFromFile(raw_filename, musicMeta.common.title, musicMeta.common.artist); const info = GetMetaFromFile(raw_filename, musicMeta.common.title, musicMeta.common.artist);