- await sequelizeTypescript.transaction(async t => {
- // Maybe the video changed in database, refresh it
- let videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.uuid, t)
- // Video does not exist anymore
- if (!videoDatabase) return undefined
-
- // If the video was not published, we consider it is a new one for other instances
- await federateVideoIfNeeded(videoDatabase, false, t)
- })
-}
-
-async function publishNewResolutionIfNeeded (video: VideoModel, payload?: NewResolutionTranscodingPayload | MergeAudioTranscodingPayload) {
- const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {
- // Maybe the video changed in database, refresh it
- let videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.uuid, t)
- // Video does not exist anymore
- if (!videoDatabase) return undefined
-
- let videoPublished = false
-
- // We transcoded the video file in another format, now we can publish it
- if (videoDatabase.state !== VideoState.PUBLISHED) {
- videoPublished = true
-
- videoDatabase.state = VideoState.PUBLISHED
- videoDatabase.publishedAt = new Date()
- videoDatabase = await videoDatabase.save({ transaction: t })
+ // We generated the HLS playlist, we don't need the webtorrent files anymore if the admin disabled it
+ if (CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
+ for (const file of video.VideoFiles) {
+ await video.removeFile(file)
+ await file.destroy()