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/activitypub/videos | |
parent | a673d9e848e51186602548a621e05925663b98be (diff) | |
download | PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.tar.gz PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.tar.zst PeerTube-f162d32da098aa55f6de2367142faa166edb7c08.zip |
Support lazy download thumbnails
Diffstat (limited to 'server/lib/activitypub/videos')
-rw-r--r-- | server/lib/activitypub/videos/shared/abstract-builder.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/lib/activitypub/videos/shared/abstract-builder.ts index 8af67ecac..e50bf29dc 100644 --- a/server/lib/activitypub/videos/shared/abstract-builder.ts +++ b/server/lib/activitypub/videos/shared/abstract-builder.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { CreationAttributes, Transaction } from 'sequelize/types' | 1 | import { CreationAttributes, Transaction } from 'sequelize/types' |
2 | import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils' | 2 | import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils' |
3 | import { logger, LoggerTagsFn } from '@server/helpers/logger' | 3 | import { logger, LoggerTagsFn } from '@server/helpers/logger' |
4 | import { updatePlaceholderThumbnail, updateVideoMiniatureFromUrl } from '@server/lib/thumbnail' | 4 | import { updateRemoteThumbnail, updateVideoMiniatureFromUrl } from '@server/lib/thumbnail' |
5 | import { setVideoTags } from '@server/lib/video' | 5 | import { setVideoTags } from '@server/lib/video' |
6 | import { StoryboardModel } from '@server/models/video/storyboard' | 6 | import { StoryboardModel } from '@server/models/video/storyboard' |
7 | import { VideoCaptionModel } from '@server/models/video/video-caption' | 7 | import { VideoCaptionModel } from '@server/models/video/video-caption' |
@@ -55,15 +55,15 @@ export abstract class APVideoAbstractBuilder { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | protected async setPreview (video: MVideoFullLight, t?: Transaction) { | 57 | protected async setPreview (video: MVideoFullLight, t?: Transaction) { |
58 | // Don't fetch the preview that could be big, create a placeholder instead | ||
59 | const previewIcon = getPreviewFromIcons(this.videoObject) | 58 | const previewIcon = getPreviewFromIcons(this.videoObject) |
60 | if (!previewIcon) return | 59 | if (!previewIcon) return |
61 | 60 | ||
62 | const previewModel = updatePlaceholderThumbnail({ | 61 | const previewModel = updateRemoteThumbnail({ |
63 | fileUrl: previewIcon.url, | 62 | fileUrl: previewIcon.url, |
64 | video, | 63 | video, |
65 | type: ThumbnailType.PREVIEW, | 64 | type: ThumbnailType.PREVIEW, |
66 | size: previewIcon | 65 | size: previewIcon, |
66 | onDisk: false // Don't fetch the preview that could be big, create a placeholder instead | ||
67 | }) | 67 | }) |
68 | 68 | ||
69 | await video.addAndSaveThumbnail(previewModel, t) | 69 | await video.addAndSaveThumbnail(previewModel, t) |