diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-19 09:56:12 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 10:19:54 +0200 |
commit | 53d4db2a8a11407165da6525cad3198439686d36 (patch) | |
tree | bcdacea812eb741eb25916a137d6f9d1bcc7704c /server/lib/activitypub | |
parent | 109d4a7f017e5ba18045f308158a71399a1b08cd (diff) | |
download | PeerTube-53d4db2a8a11407165da6525cad3198439686d36.tar.gz PeerTube-53d4db2a8a11407165da6525cad3198439686d36.tar.zst PeerTube-53d4db2a8a11407165da6525cad3198439686d36.zip |
Fix playlist thumbnail generation
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/playlists/create-update.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/videos/shared/abstract-builder.ts | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/activitypub/playlists/create-update.ts b/server/lib/activitypub/playlists/create-update.ts index 920d3943a..b24299f29 100644 --- a/server/lib/activitypub/playlists/create-update.ts +++ b/server/lib/activitypub/playlists/create-update.ts | |||
@@ -4,7 +4,7 @@ import { retryTransactionWrapper } from '@server/helpers/database-utils' | |||
4 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 4 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
5 | import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants' | 5 | import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants' |
6 | import { sequelizeTypescript } from '@server/initializers/database' | 6 | import { sequelizeTypescript } from '@server/initializers/database' |
7 | import { updatePlaylistMiniatureFromUrl } from '@server/lib/thumbnail' | 7 | import { updateRemotePlaylistMiniatureFromUrl } from '@server/lib/thumbnail' |
8 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' | 8 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' |
9 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' | 9 | import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' |
10 | import { FilteredModelAttributes } from '@server/types' | 10 | import { FilteredModelAttributes } from '@server/types' |
@@ -104,7 +104,7 @@ async function updatePlaylistThumbnail (playlistObject: PlaylistObject, playlist | |||
104 | let thumbnailModel: MThumbnail | 104 | let thumbnailModel: MThumbnail |
105 | 105 | ||
106 | try { | 106 | try { |
107 | thumbnailModel = await updatePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist }) | 107 | thumbnailModel = await updateRemotePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist }) |
108 | await playlist.setAndSaveThumbnail(thumbnailModel, undefined) | 108 | await playlist.setAndSaveThumbnail(thumbnailModel, undefined) |
109 | } catch (err) { | 109 | } catch (err) { |
110 | logger.warn('Cannot set thumbnail of %s.', playlistObject.id, { err, ...lTags(playlistObject.id, playlist.uuid, playlist.url) }) | 110 | logger.warn('Cannot set thumbnail of %s.', playlistObject.id, { err, ...lTags(playlistObject.id, playlist.uuid, playlist.url) }) |
diff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/lib/activitypub/videos/shared/abstract-builder.ts index 4f74316d3..8b6a7fd75 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 { updateRemoteThumbnail } from '@server/lib/thumbnail' | 4 | import { updateRemoteVideoThumbnail } 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' |
@@ -48,7 +48,7 @@ export abstract class APVideoAbstractBuilder { | |||
48 | return undefined | 48 | return undefined |
49 | } | 49 | } |
50 | 50 | ||
51 | const miniatureModel = updateRemoteThumbnail({ | 51 | const miniatureModel = updateRemoteVideoThumbnail({ |
52 | fileUrl: miniatureIcon.url, | 52 | fileUrl: miniatureIcon.url, |
53 | video, | 53 | video, |
54 | type: ThumbnailType.MINIATURE, | 54 | type: ThumbnailType.MINIATURE, |
@@ -63,12 +63,12 @@ export abstract class APVideoAbstractBuilder { | |||
63 | const previewIcon = getPreviewFromIcons(this.videoObject) | 63 | const previewIcon = getPreviewFromIcons(this.videoObject) |
64 | if (!previewIcon) return | 64 | if (!previewIcon) return |
65 | 65 | ||
66 | const previewModel = updateRemoteThumbnail({ | 66 | const previewModel = updateRemoteVideoThumbnail({ |
67 | fileUrl: previewIcon.url, | 67 | fileUrl: previewIcon.url, |
68 | video, | 68 | video, |
69 | type: ThumbnailType.PREVIEW, | 69 | type: ThumbnailType.PREVIEW, |
70 | size: previewIcon, | 70 | size: previewIcon, |
71 | onDisk: false // Don't fetch the preview that could be big, create a placeholder instead | 71 | onDisk: false // Lazy download remote previews |
72 | }) | 72 | }) |
73 | 73 | ||
74 | await video.addAndSaveThumbnail(previewModel, t) | 74 | await video.addAndSaveThumbnail(previewModel, t) |