Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Transcoder
Commits
ac8bda45
Commit
ac8bda45
authored
Aug 16, 2018
by
A. Koch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added timecode signals route
parent
056c7d3c
Pipeline
#1059
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
src/lib/timecodes.js
src/lib/timecodes.js
+18
-0
No files found.
src/lib/timecodes.js
View file @
ac8bda45
...
...
@@ -4,6 +4,7 @@ const
TinyEmitter
=
require
(
'
tiny-emitter
'
),
Queue
=
require
(
'
bull
'
),
path
=
require
(
'
path
'
),
Minio
=
require
(
'
minio
'
),
{
DateTime
}
=
require
(
'
luxon
'
),
{
ObjectUtil
}
=
require
(
'
mbjs-utils
'
)
...
...
@@ -14,6 +15,8 @@ class Timecodes extends TinyEmitter {
this
.
_queue
=
new
Queue
(
'
timecode
'
,
config
.
timecode
.
redisURL
)
this
.
_queue
.
process
(
parseInt
(
config
.
timecode
.
concurrency
),
path
.
join
(
__dirname
,
'
workers
'
,
'
extract-ltc.js
'
))
this
.
_minio
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
_this
=
this
app
.
post
(
'
/timecodes
'
,
async
(
req
,
res
)
=>
{
...
...
@@ -23,6 +26,21 @@ class Timecodes extends TinyEmitter {
_this
.
_response
(
req
,
res
,
{
jobId
})
})
app
.
get
(
'
/timecodes/signals/ltc
'
,
async
(
req
,
res
)
=>
{
const
files
=
[]
const
stream
=
await
this
.
_minio
.
listObjects
(
'
ltc
'
,
'
LTC
'
)
stream
.
on
(
'
data
'
,
obj
=>
files
.
push
(
obj
.
name
))
stream
.
on
(
'
error
'
,
err
=>
_this
.
_errorResponse
(
res
,
500
,
err
.
message
))
stream
.
on
(
'
end
'
,
()
=>
{
let
assetHost
=
`
${
config
.
assets
.
client
.
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
config
.
assets
.
client
.
port
!==
80
&&
config
.
assets
.
client
.
port
!==
443
)
assetHost
+=
`:
${
config
.
assets
.
client
.
port
}
`
assetHost
+=
'
/ltc
'
_this
.
_response
(
req
,
res
,
files
.
map
(
file
=>
{
return
`
${
assetHost
}
/
${
file
}
`
}))
})
})
app
.
get
(
'
/timecodes/:id
'
,
async
(
req
,
res
)
=>
{
const
job
=
await
_this
.
_queue
.
getJob
(
req
.
params
.
id
)
if
(
!
job
)
return
_this
.
_errorResponse
(
res
,
404
)
...
...
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