File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ transcriber.js
2
2
test-config.json
3
3
public-test-config.json
4
4
node_modules /
5
+ models /*
Original file line number Diff line number Diff line change @@ -75,17 +75,19 @@ utils.events.on("error", (data) => {
75
75
console . error ( "worker error: " + data ) ;
76
76
} ) ;
77
77
if ( workerData ) {
78
- if ( workerData . type == "command" ) {
79
- utils . getVideoData ( workerData . query ) . then ( ( videoData ) => {
78
+ try {
79
+ if ( workerData . type == "command" ) {
80
+ const videoData = await utils . getVideoData ( workerData . query )
80
81
parentPort . postMessage ( JSON . stringify ( videoData ) ) ;
81
- } ) ;
82
- } else if ( workerData . type == "voiceCommand" ) {
83
- utils . search ( workerData . query , false ) . then ( ( videoData ) => {
82
+ } else if ( workerData . type == "voiceCommand" ) {
83
+ const videoData = await utils . search ( workerData . query , false )
84
84
if ( videoData ) {
85
- parentPort . postMessage ( { type : "video" , data : JSON . stringify ( videoData ) } ) ;
85
+ parentPort . postMessage ( { type : "video" , data : JSON . stringify ( videoData ) } ) ;
86
86
} else {
87
87
parentPort . postMessage ( "false" ) ;
88
88
}
89
- } ) ;
89
+ }
90
+ } catch ( e ) {
91
+ console . log ( "worker error: " , e ) ;
90
92
}
91
- }
93
+ }
You can’t perform that action at this time.
0 commit comments