Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iGEM.org Backend
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iGEM HQ Tech
iGEM.org Backend
Commits
966236a1
Commit
966236a1
authored
4 months ago
by
Tianyi Liang
Browse files
Options
Downloads
Patches
Plain Diff
[SD-235] trial
parent
219159f3
No related branches found
Branches containing commit
No related tags found
1 merge request
!562
Resolve SD-235 "Feat/ booth screen video"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/videos/videos.service.ts
+83
-3
83 additions, 3 deletions
src/modules/videos/videos.service.ts
with
83 additions
and
3 deletions
src/modules/videos/videos.service.ts
+
83
−
3
View file @
966236a1
...
...
@@ -293,9 +293,7 @@ export class VideosService {
teamID
,
TeamArtifactType
.
PROJECT_PROMOTION
,
)
).
find
(
(
video
)
=>
video
.
value
.
language
===
'
en
'
,
)
).
find
((
video
)
=>
video
.
value
.
language
===
'
en
'
)
if
(
promotionVideo
==
null
)
{
continue
}
...
...
@@ -307,6 +305,10 @@ export class VideosService {
continue
}
if
(
!
fs
.
existsSync
(
'
./tmp
'
))
{
await
fs
.
promises
.
mkdir
(
'
./tmp
'
,
{
recursive
:
true
})
}
await
this
.
downloadFile
(
`https://static.igem.org/
${
videoFileKey
}
`
,
`./tmp/
${
teamID
}
-
${
slug
}
.mp4`
,
...
...
@@ -360,4 +362,82 @@ export class VideosService {
throw
e
}
}
async
generateBoothVideoByTeamID
(
teamID
:
number
,
author
:
AccountUUID
,
event
:
ActivityLogEvent
,
):
Promise
<
void
>
{
try
{
const
{
year
,
slug
}
=
await
this
.
teams
.
findOne
(
teamID
)
const
promotionVideo
=
(
await
this
.
videoSubmissions
.
fetchAllByTeam
(
teamID
,
TeamArtifactType
.
PROJECT_PROMOTION
,
)
).
find
((
video
)
=>
video
.
value
.
language
===
'
en
'
)
if
(
promotionVideo
==
null
)
{
return
}
const
{
videoFileKey
,
captionFileKeys
}
=
promotionVideo
.
value
const
mainCaptionFileKey
=
captionFileKeys
?.
find
((
key
)
=>
key
.
includes
(
'
en
'
),
)
if
(
mainCaptionFileKey
==
null
)
{
return
}
await
this
.
downloadFile
(
`https://static.igem.org/
${
videoFileKey
}
`
,
`./tmp/
${
teamID
}
-
${
slug
}
.mp4`
,
)
await
this
.
downloadFile
(
`https://static.igem.org/
${
mainCaptionFileKey
}
`
,
`./tmp/
${
teamID
}
-
${
slug
}
.vtt`
,
)
await
this
.
downloadFile
(
`https://static.igem.org/websites/jamboree/2024/overlays/
${
teamID
}
-
${
slug
}
.png`
,
`./tmp/
${
teamID
}
-
${
slug
}
-overlay.png`
,
)
await
this
.
embedCaption
(
teamID
,
slug
).
then
(
async
()
=>
{
fs
.
unlinkSync
(
`./tmp/
${
teamID
}
-
${
slug
}
.mp4`
)
fs
.
unlinkSync
(
`./tmp/
${
teamID
}
-
${
slug
}
.vtt`
)
})
await
this
.
embedOverlay
(
teamID
,
slug
).
then
(
async
()
=>
{
const
file
=
fs
.
readFileSync
(
`./tmp/overlayed-
${
teamID
}
-
${
slug
}
.mp4`
)
const
key
=
`websites/jamboree/2024/videos/
${
year
}
/
${
teamID
}
-
${
slug
}
.mp4`
await
this
.
s3
.
uploadObject
({
key
,
body
:
file
,
contentType
:
'
video/mp4
'
,
})
.
then
(
async
()
=>
{
fs
.
unlinkSync
(
`./tmp/
${
teamID
}
-
${
slug
}
-overlay.png`
)
fs
.
unlinkSync
(
`./tmp/overlayed-
${
teamID
}
-
${
slug
}
.mp4`
)
})
})
await
this
.
activityLogs
.
insert
(
{
event
,
status
:
ActivityLogEventStatus
.
COMPLETED
,
},
author
,
)
}
catch
(
e
)
{
await
this
.
activityLogs
.
insert
(
{
event
,
status
:
ActivityLogEventStatus
.
FAILED
,
metadata
:
{
e
},
},
author
,
)
throw
e
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment