Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jensen
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Skye Yu
jensen
Commits
ef0dc190
Commit
ef0dc190
authored
Aug 20, 2025
by
martin hou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 还原文件列表查询的实现,取消超时处理
parent
0aaa0fa0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
85 deletions
+14
-85
jensen.js
src/utils/jensen.js
+14
-85
No files found.
src/utils/jensen.js
View file @
ef0dc190
...
...
@@ -689,34 +689,25 @@ Jensen.prototype.getBluetoothStatus = async function (seconds) {
};
Jensen
.
prototype
.
listFiles
=
async
function
()
{
let
tag
=
'filelist-'
+
this
.
serialNumber
+
'-'
+
this
.
sequence
()
;
let
tag
=
'filelist-'
+
this
.
serialNumber
;
if
(
this
[
tag
]
!=
null
)
return
null
;
let
fc
=
null
;
if
(
typeof
this
.
versionNumber
==
'undefined'
||
this
.
versionNumber
<=
327722
)
{
fc
=
await
this
.
getFileCount
(
5
);
fc
=
fc
?
fc
.
count
:
0
;
// if (fc == null) return [];
if
(
fc
==
null
)
return
null
;
}
if
(
fc
==
0
)
return
[];
console
.
log
(
'file count: '
+
fc
);
if
(
fc
&&
fc
.
count
==
0
)
return
null
;
let
self
=
this
;
// let tag = 'data_' + new Date().getTime();
this
[
tag
]
=
[];
this
[
tag
+
'-ts'
]
=
0
;
this
.
registerHandler
(
QUERY_FILE_LIST
,
(
msg
,
jensen
)
=>
{
console
.
log
(
'tag'
,
tag
);
if
(
msg
.
body
.
length
==
0
)
{
console
.
log
(
'remove tag1: '
+
tag
);
if
(
msg
.
body
.
length
==
0
)
{
jensen
[
tag
]
=
null
;
return
[];
}
if
(
jensen
[
tag
]
==
null
)
{
console
.
trace
(
'no tag for: '
+
tag
);
return
'x'
;
}
jensen
[
tag
].
push
(
msg
.
body
);
let
data
=
[];
let
files
=
[];
...
...
@@ -787,99 +778,37 @@ Jensen.prototype.listFiles = async function () {
{
duration
=
flen
/
12
;
}
else
if
(
ver
==
6
)
{
duration
=
flen
/
16
;
}
let
createDate
=
''
;
let
createTime
=
''
;
if
(
ftime
)
{
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
,
name
:
fname
.
join
(
''
)
,
createDate
:
createDate
,
createTime
:
createTime
,
time
:
ftime
,
duration
:
duration
,
version
:
ver
,
length
:
flen
,
mode
:
mode
,
signature
:
sign
.
join
(
''
)
});
// console.log(`Sign1: ${sign.join('')}, Sign2: ${sign2}`);
}
// if (fcount == -1 && (fc))
// 如果没有判断数量的依据
if
(
fcount
==
-
1
)
{
// return [];
}
// 如果files有重复的signature,那就持续改为不重复的为止
// Check for duplicate signatures and regenerate if needed
const
signatureCounts
=
{};
files
.
forEach
(
file
=>
{
signatureCounts
[
file
.
signature
]
=
(
signatureCounts
[
file
.
signature
]
||
0
)
+
1
;
if
((
fc
&&
files
.
length
>=
fc
.
count
)
||
(
fcount
>
-
1
&&
files
.
length
>=
fcount
))
{
// delete jensen[tag];
jensen
[
tag
]
=
null
;
return
files
.
filter
((
f
)
=>
{
return
Boolean
(
f
.
time
);
});
// Only regenerate signatures for items that have duplicates
files
.
forEach
(
file
=>
{
if
(
signatureCounts
[
file
.
signature
]
>
1
)
{
// Add timestamp to make signature unique
file
.
signature
=
md5
(
`
${
file
.
name
}${
file
.
length
}
`
);
}
});
// 如果已经等待过长的时间了,那就直接返回好了
let
kv
=
tag
+
'-timer'
;
let
now
=
new
Date
().
getTime
();
if
(
kv
in
jensen
)
{
window
.
clearTimeout
(
jensen
[
kv
]);
}
jensen
[
kv
]
=
now
;
let
ts
=
2500
;
if
(
fc
==
files
.
length
)
{
return
files
.
filter
((
f
)
=>
{
return
Boolean
(
f
.
time
);
});
}
jensen
[
tag
+
'-ts'
]
+=
3000
;
// console.log('ts, fc, files.length', ts, fc, files.length);
console
.
log
(
tag
,
'timeout'
,
jensen
[
tag
+
'-ts'
]);
jensen
[
kv
]
=
window
.
setTimeout
(()
=>
{
console
.
log
(
'remove tag: '
+
tag
);
jensen
[
tag
]
=
null
;
jensen
.
_trigger
(
files
.
filter
((
f
)
=>
{
return
Boolean
(
f
.
time
);
}),
QUERY_FILE_LIST
);
console
.
log
(
'jensen'
,
'list-files'
,
'timed return'
);
},
jensen
[
tag
+
'-ts'
]);
});
return
this
.
send
(
new
Command
(
QUERY_FILE_LIST
));
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment