Commit ff80c5f9 authored by martin hou's avatar martin hou

feat: 增加对录音模式的兼容读取

parent 0cf71b5f
......@@ -36,6 +36,7 @@ export type FileInfo = {
time: Date; // 录音时间
duration: number; // 持续时长,单位为毫秒
length: number; // 文件长度,单位为字节
mode: 'room' | 'whisper' | 'call'; // 录音模式,room:现场录音,whisper:小笔记,call:通话
signature: string; // 文件签名,0长度的文件或是录音中的文件的值为000000000000000000000000000000000
};
......
......@@ -88,6 +88,7 @@ export function Home() {
let fc = await jensen.getFileCount();
// alert(fc?.count);
let files = await jensen.listFiles();
console.log(files);
setFiles(files)
}
......
......@@ -780,14 +780,38 @@ Jensen.prototype.listFiles = async function () {
createDate = ftime.getFullYear() + '/' + fnpad(ftime.getMonth() + 1) + '/' + fnpad(ftime.getDate());
createTime = fnpad(ftime.getHours()) + ':' + fnpad(ftime.getMinutes()) + ':' + fnpad(ftime.getSeconds());
}
let mode = 'room';
// 如果是旧的whisper mode
fname = fname.join('');
if (fname.match(/^.*REC\d+\.(hda|wav)$/gi))
{
mode = 'room';
}
else if (fname.match(/^.*WIP\d+\.(hda|wav)$/gi))
{
mode = 'whisper';
}
else if (fname.match(/^.*CALL\d+\.(hda|wav)$/gi))
{
mode = 'call';
}
else if (fname.match(/^.*ROOM\d+\.(hda|wav)$/gi))
{
mode = 'room';
}
else if (fname.match(/^.*WHSP\d+\.(hda|wav)$/gi))
{
mode = 'whisper';
}
files.push({
name: fname.join(''),
name: fname,
createDate: createDate,
createTime: createTime,
time: ftime,
duration: duration,
version: ver,
length: flen,
mode: mode,
signature: sign.join('')
});
// console.log(`Sign1: ${sign.join('')}, Sign2: ${sign2}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment