1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add modal to display live information

This commit is contained in:
Chocobozzz 2020-10-28 10:49:20 +01:00 committed by Chocobozzz
parent 31c82cd914
commit d846d99c6c
18 changed files with 183 additions and 40 deletions

View file

@ -1,4 +1,5 @@
import * as Bull from 'bull'
import { publishAndFederateIfNeeded } from '@server/lib/video'
import { getVideoFilePath } from '@server/lib/video-paths'
import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
import {
@ -174,25 +175,3 @@ function createHlsJobIfEnabled (payload?: { videoUUID: string, resolution: numbe
return JobQueue.Instance.createJob({ type: 'video-transcoding', payload: hlsTranscodingPayload })
}
}
async function publishAndFederateIfNeeded (video: MVideoUUID) {
const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {
// Maybe the video changed in database, refresh it
const videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(video.uuid, t)
// Video does not exist anymore
if (!videoDatabase) return undefined
// We transcoded the video file in another format, now we can publish it
const videoPublished = await videoDatabase.publishIfNeededAndSave(t)
// If the video was not published, we consider it is a new one for other instances
await federateVideoIfNeeded(videoDatabase, videoPublished, t)
return { videoDatabase, videoPublished }
})
if (videoPublished) {
Notifier.Instance.notifyOnNewVideoIfNeeded(videoDatabase)
Notifier.Instance.notifyOnVideoPublishedAfterTranscoding(videoDatabase)
}
}