diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-06 15:59:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 10:19:33 +0200 |
commit | f162d32da098aa55f6de2367142faa166edb7c08 (patch) | |
tree | 31c6a96972994171853cb6c4e0b88b63241f8979 /server/lib/job-queue | |
parent | a673d9e848e51186602548a621e05925663b98be (diff) | |
download | PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.tar.gz PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.tar.zst PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.zip |
Support lazy download thumbnails
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 4 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-live-ending.ts | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index c1355dcef..436bf3175 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -39,7 +39,7 @@ import { VideoFileModel } from '../../../models/video/video-file' | |||
39 | import { VideoImportModel } from '../../../models/video/video-import' | 39 | import { VideoImportModel } from '../../../models/video/video-import' |
40 | import { federateVideoIfNeeded } from '../../activitypub/videos' | 40 | import { federateVideoIfNeeded } from '../../activitypub/videos' |
41 | import { Notifier } from '../../notifier' | 41 | import { Notifier } from '../../notifier' |
42 | import { generateVideoMiniature } from '../../thumbnail' | 42 | import { generateLocalVideoMiniature } from '../../thumbnail' |
43 | import { JobQueue } from '../job-queue' | 43 | import { JobQueue } from '../job-queue' |
44 | 44 | ||
45 | async function processVideoImport (job: Job): Promise<VideoImportPreventExceptionResult> { | 45 | async function processVideoImport (job: Job): Promise<VideoImportPreventExceptionResult> { |
@@ -274,7 +274,7 @@ async function generateMiniature (videoImportWithFiles: MVideoImportDefaultFiles | |||
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | const miniatureModel = await generateVideoMiniature({ | 277 | const miniatureModel = await generateLocalVideoMiniature({ |
278 | video: videoImportWithFiles.Video, | 278 | video: videoImportWithFiles.Video, |
279 | videoFile, | 279 | videoFile, |
280 | type: thumbnailType | 280 | type: thumbnailType |
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 95d4f5e64..ae886de35 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts | |||
@@ -7,7 +7,7 @@ import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | |||
7 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | 7 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' |
8 | import { cleanupAndDestroyPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live' | 8 | import { cleanupAndDestroyPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live' |
9 | import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getLiveReplayBaseDirectory } from '@server/lib/paths' | 9 | import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getLiveReplayBaseDirectory } from '@server/lib/paths' |
10 | import { generateVideoMiniature } from '@server/lib/thumbnail' | 10 | import { generateLocalVideoMiniature } from '@server/lib/thumbnail' |
11 | import { generateHlsPlaylistResolutionFromTS } from '@server/lib/transcoding/hls-transcoding' | 11 | import { generateHlsPlaylistResolutionFromTS } from '@server/lib/transcoding/hls-transcoding' |
12 | import { VideoPathManager } from '@server/lib/video-path-manager' | 12 | import { VideoPathManager } from '@server/lib/video-path-manager' |
13 | import { moveToNextState } from '@server/lib/video-state' | 13 | import { moveToNextState } from '@server/lib/video-state' |
@@ -143,7 +143,7 @@ async function saveReplayToExternalVideo (options: { | |||
143 | await remove(replayDirectory) | 143 | await remove(replayDirectory) |
144 | 144 | ||
145 | for (const type of [ ThumbnailType.MINIATURE, ThumbnailType.PREVIEW ]) { | 145 | for (const type of [ ThumbnailType.MINIATURE, ThumbnailType.PREVIEW ]) { |
146 | const image = await generateVideoMiniature({ video: replayVideo, videoFile: replayVideo.getMaxQualityFile(), type }) | 146 | const image = await generateLocalVideoMiniature({ video: replayVideo, videoFile: replayVideo.getMaxQualityFile(), type }) |
147 | await replayVideo.addAndSaveThumbnail(image) | 147 | await replayVideo.addAndSaveThumbnail(image) |
148 | } | 148 | } |
149 | 149 | ||
@@ -198,7 +198,7 @@ async function replaceLiveByReplay (options: { | |||
198 | 198 | ||
199 | // Regenerate the thumbnail & preview? | 199 | // Regenerate the thumbnail & preview? |
200 | if (videoWithFiles.getMiniature().automaticallyGenerated === true) { | 200 | if (videoWithFiles.getMiniature().automaticallyGenerated === true) { |
201 | const miniature = await generateVideoMiniature({ | 201 | const miniature = await generateLocalVideoMiniature({ |
202 | video: videoWithFiles, | 202 | video: videoWithFiles, |
203 | videoFile: videoWithFiles.getMaxQualityFile(), | 203 | videoFile: videoWithFiles.getMaxQualityFile(), |
204 | type: ThumbnailType.MINIATURE | 204 | type: ThumbnailType.MINIATURE |
@@ -207,7 +207,7 @@ async function replaceLiveByReplay (options: { | |||
207 | } | 207 | } |
208 | 208 | ||
209 | if (videoWithFiles.getPreview().automaticallyGenerated === true) { | 209 | if (videoWithFiles.getPreview().automaticallyGenerated === true) { |
210 | const preview = await generateVideoMiniature({ | 210 | const preview = await generateLocalVideoMiniature({ |
211 | video: videoWithFiles, | 211 | video: videoWithFiles, |
212 | videoFile: videoWithFiles.getMaxQualityFile(), | 212 | videoFile: videoWithFiles.getMaxQualityFile(), |
213 | type: ThumbnailType.PREVIEW | 213 | type: ThumbnailType.PREVIEW |