Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LINAGORA
L
LGS
Labs
linstt-controller
Commits
0706f944
Commit
0706f944
authored
Dec 07, 2017
by
Yoann HOUPERT
Browse files
use request body instead of file
parent
c335b71e
Pipeline
#6910
failed with stage
in 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
9 deletions
+4
-9
app.js
app.js
+1
-3
lib/controller/speech-enhancement.js
lib/controller/speech-enhancement.js
+1
-1
lib/webserver/routes.js
lib/webserver/routes.js
+2
-5
No files found.
app.js
View file @
0706f944
...
...
@@ -21,7 +21,6 @@ const https = require('https');
const
fs
=
require
(
'
fs
'
);
const
app
=
require
(
'
express
'
)();
const
fileUpload
=
require
(
'
express-fileupload
'
);
const
bodyParser
=
require
(
'
body-parser
'
);
const
config
=
require
(
'
./config.json
'
);
...
...
@@ -29,8 +28,7 @@ const routes = require('./lib/webserver/routes');
console
.
log
(
'
starting routes linstt-controller...
'
);
app
.
use
(
bodyParser
.
raw
({
type
:
'
audio/wav
'
,
limit
:
'
200mb
'
}));
app
.
use
(
fileUpload
());
app
.
use
(
bodyParser
.
raw
({
type
:
'
audio/wave
'
,
limit
:
'
200mb
'
}));
app
.
use
(
'
/
'
,
routes
.
routesFactory
(
config
.
orchestrator
));
app
.
listen
(
config
.
api
,
()
=>
{
...
...
lib/controller/speech-enhancement.js
View file @
0706f944
...
...
@@ -29,7 +29,7 @@ module.exports = config => {
url
,
formData
:
{
wavFile
:
{
value
:
wavFile
.
data
,
value
:
wavFile
,
options
:
{
filename
:
'
wavFile
'
,
contentType
:
'
audio/x-wav
'
...
...
lib/webserver/routes.js
View file @
0706f944
...
...
@@ -26,14 +26,11 @@ const routesFactory = config => {
const
checker
=
require
(
'
../util/checker
'
);
routes
.
post
(
'
/api/transcript
'
,
(
req
,
res
)
=>
{
if
(
!
req
.
files
)
{
if
(
!
req
.
body
)
{
return
res
.
status
(
400
).
send
(
'
No files were uploaded.
'
);
}
if
(
!
checker
.
isFileValid
(
req
.
files
.
wav
))
{
return
res
.
status
(
400
).
send
(
'
File is not valid.
'
);
}
enhancer
.
enhancement
(
req
.
files
.
wav
,
(
err
,
httpResponse
,
body
)
=>
{
enhancer
.
enhancement
(
req
.
body
,
(
err
,
httpResponse
,
body
)
=>
{
if
(
err
)
{
return
res
.
status
(
500
).
send
(
'
Error while enhancing audio.
'
+
err
);
}
...
...
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