aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-16 08:50:40 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-16 10:36:44 +0100
commita35a22797c99f17924347da9a226068c3dbe4787 (patch)
treeaffb713929145f90f6bda8828ded3ac2f4f73b19 /server/lib/job-queue/handlers
parent6302d599cdf98b5a5363a2a1dcdc266447950191 (diff)
downloadPeerTube-a35a22797c99f17924347da9a226068c3dbe4787.tar.gz
PeerTube-a35a22797c99f17924347da9a226068c3dbe4787.tar.zst
PeerTube-a35a22797c99f17924347da9a226068c3dbe4787.zip
Remove previous thumbnail if needed
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-import.ts12
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts12
2 files changed, 20 insertions, 4 deletions
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<string>, videoImport: MVid
162 let thumbnailModel: MThumbnail 162 let thumbnailModel: MThumbnail
163 let thumbnailSave: object 163 let thumbnailSave: object
164 if (!videoImportWithFiles.Video.getMiniature()) { 164 if (!videoImportWithFiles.Video.getMiniature()) {
165 thumbnailModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.MINIATURE) 165 thumbnailModel = await generateVideoMiniature({
166 video: videoImportWithFiles.Video,
167 videoFile,
168 type: ThumbnailType.MINIATURE
169 })
166 thumbnailSave = thumbnailModel.toJSON() 170 thumbnailSave = thumbnailModel.toJSON()
167 } 171 }
168 172
@@ -170,7 +174,11 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
170 let previewModel: MThumbnail 174 let previewModel: MThumbnail
171 let previewSave: object 175 let previewSave: object
172 if (!videoImportWithFiles.Video.getPreview()) { 176 if (!videoImportWithFiles.Video.getPreview()) {
173 previewModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.PREVIEW) 177 previewModel = await generateVideoMiniature({
178 video: videoImportWithFiles.Video,
179 videoFile,
180 type: ThumbnailType.PREVIEW
181 })
174 previewSave = previewModel.toJSON() 182 previewSave = previewModel.toJSON()
175 } 183 }
176 184
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) {
122 122
123 // Regenerate the thumbnail & preview? 123 // Regenerate the thumbnail & preview?
124 if (videoWithFiles.getMiniature().automaticallyGenerated === true) { 124 if (videoWithFiles.getMiniature().automaticallyGenerated === true) {
125 await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.MINIATURE) 125 await generateVideoMiniature({
126 video: videoWithFiles,
127 videoFile: videoWithFiles.getMaxQualityFile(),
128 type: ThumbnailType.MINIATURE
129 })
126 } 130 }
127 131
128 if (videoWithFiles.getPreview().automaticallyGenerated === true) { 132 if (videoWithFiles.getPreview().automaticallyGenerated === true) {
129 await generateVideoMiniature(videoWithFiles, videoWithFiles.getMaxQualityFile(), ThumbnailType.PREVIEW) 133 await generateVideoMiniature({
134 video: videoWithFiles,
135 videoFile: videoWithFiles.getMaxQualityFile(),
136 type: ThumbnailType.PREVIEW
137 })
130 } 138 }
131 139
132 await publishAndFederateIfNeeded(videoWithFiles, true) 140 await publishAndFederateIfNeeded(videoWithFiles, true)