From a35a22797c99f17924347da9a226068c3dbe4787 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 16 Feb 2021 08:50:40 +0100 Subject: Remove previous thumbnail if needed --- server/lib/job-queue/handlers/video-import.ts | 12 ++++++++++-- server/lib/job-queue/handlers/video-live-ending.ts | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'server/lib/job-queue/handlers') diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 1e5e52b58..0d00c1b9d 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -162,7 +162,11 @@ async function processFile (downloader: () => Promise, videoImport: MVid let thumbnailModel: MThumbnail let thumbnailSave: object if (!videoImportWithFiles.Video.getMiniature()) { - thumbnailModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.MINIATURE) + thumbnailModel = await generateVideoMiniature({ + video: videoImportWithFiles.Video, + videoFile, + type: ThumbnailType.MINIATURE + }) thumbnailSave = thumbnailModel.toJSON() } @@ -170,7 +174,11 @@ async function processFile (downloader: () => Promise, videoImport: MVid let previewModel: MThumbnail let previewSave: object if (!videoImportWithFiles.Video.getPreview()) { - previewModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.PREVIEW) + previewModel = await generateVideoMiniature({ + video: videoImportWithFiles.Video, + videoFile, + type: ThumbnailType.PREVIEW + }) previewSave = previewModel.toJSON() } diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index db6cd3682..6d50635bb 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts @@ -122,11 +122,19 @@ async function saveLive (video: MVideo, live: MVideoLive) { // Regenerate the thumbnail & preview? if (videoWithFiles.getMiniature().automaticallyGenerated === true) { - await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.MINIATURE) + await generateVideoMiniature({ + video: videoWithFiles, + videoFile: videoWithFiles.getMaxQualityFile(), + type: ThumbnailType.MINIATURE + }) } if (videoWithFiles.getPreview().automaticallyGenerated === true) { - await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.PREVIEW) + await generateVideoMiniature({ + video: videoWithFiles, + videoFile: videoWithFiles.getMaxQualityFile(), + type: ThumbnailType.PREVIEW + }) } await publishAndFederateIfNeeded(videoWithFiles, true) -- cgit v1.2.3