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

Regenerate miniature on live save

This commit is contained in:
Chocobozzz 2020-11-06 10:57:40 +01:00 committed by Chocobozzz
parent 3bc68dfd61
commit 053aed43fb
12 changed files with 61 additions and 69 deletions

View file

@ -10,8 +10,9 @@ import { VideoFileModel } from '@server/models/video/video-file'
import { VideoLiveModel } from '@server/models/video/video-live'
import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models'
import { VideoLiveEndingPayload, VideoState } from '@shared/models'
import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models'
import { logger } from '../../../helpers/logger'
import { generateVideoMiniature } from '@server/lib/thumbnail'
async function processVideoLiveEnding (job: Bull.Job) {
const payload = job.data as VideoLiveEndingPayload
@ -109,6 +110,15 @@ async function saveLive (video: MVideo, live: MVideoLive) {
await remove(videoInputPath)
}
// Regenerate the thumbnail & preview?
if (videoWithFiles.getMiniature().automaticallyGenerated === true) {
await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.MINIATURE)
}
if (videoWithFiles.getPreview().automaticallyGenerated === true) {
await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.PREVIEW)
}
await publishAndFederateIfNeeded(video, true)
}