]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/video-live-ending.ts
Revert some mistakes
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / video-live-ending.ts
index 3892260c46ca6c3ee827c9a71206e445e06725de..55c7a4ccbc84dc74bdf331e1e702bba8ef213ac6 100644 (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,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)