X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fjob-queue%2Fhandlers%2Fvideo-live-ending.ts;h=55c7a4ccbc84dc74bdf331e1e702bba8ef213ac6;hb=529f037294d9917a62235f8162887a8edc04c32f;hp=2b900998a9c7da05a3927b88a999b9e7d83915a5;hpb=68e70a745b2010cd0199864a2addd60d8f99c732;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 2b900998a..55c7a4ccb 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts @@ -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 @@ -70,10 +71,6 @@ async function saveLive (video: MVideo, live: MVideoLive) { const segmentFiles = files.filter(f => f.startsWith(shouldStartWith) && f.endsWith('.ts')) await hlsPlaylistToFragmentedMP4(hlsDirectory, segmentFiles, mp4TmpPath) - for (const file of segmentFiles) { - await remove(join(hlsDirectory, file)) - } - if (!duration) { duration = await getDurationFromVideoFile(mp4TmpPath) } @@ -113,11 +110,20 @@ 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) } async function cleanupLive (video: MVideo, streamingPlaylist: MStreamingPlaylist) { - const hlsDirectory = getHLSDirectory(video, false) + const hlsDirectory = getHLSDirectory(video) await remove(hlsDirectory)