Commit c9853aec authored by martin hou's avatar martin hou

feat: 增加模式的识别

parent 7f27a5e9
......@@ -36,7 +36,7 @@ export type FileInfo = {
time: Date; // 录音时间
duration: number; // 持续时长,单位为毫秒
length: number; // 文件长度,单位为字节
mode: 'room' | 'whisper' | 'call'; // 录音模式,room:现场录音,whisper:小笔记,call:通话
mode: 'room' | 'whisper' | 'call' | null; // 录音模式,room:现场录音,whisper:小笔记,call:通话
signature: string; // 文件签名,0长度的文件或是录音中的文件的值为000000000000000000000000000000000
};
......
......@@ -763,6 +763,7 @@ Jensen.prototype.listFiles = async function () {
}
let ftime = fname.join('');
let duration = 0;
let mode = 'room';
if (ftime.match(/^\d{14}REC\d+\.wav$/gi)) {
ftime = ftime.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})REC.*$/gi, '$1-$2-$3 $4:$5:$6');
ftime = new Date(ftime);
......@@ -793,6 +794,13 @@ Jensen.prototype.listFiles = async function () {
{
duration = flen / 12;
}
// "2025Sep24-180808-Call01.hda"
mode = fname.join('').replace(/^(\w{9})-(\d{6})-(.+?)\d+\.\w+$/gi, '$3').toUpperCase();
console.log('mode:', fname.join(''), mode);
if (mode == 'WHSP' || mode == 'WIP') mode = 'whisper';
else if (mode == 'ROOM') mode = 'room';
else if (mode == 'CALL') mode = 'call';
else mode = 'room';
let createDate = '';
let createTime = '';
if (ftime) {
......@@ -807,6 +815,7 @@ Jensen.prototype.listFiles = async function () {
duration: duration,
version: ver,
length: flen,
mode: mode,
signature: sign.join('')
});
}
......
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