aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-19 09:56:12 +0200
committerChocobozzz <me@florianbigard.com>2023-06-29 10:19:54 +0200
commit53d4db2a8a11407165da6525cad3198439686d36 (patch)
treebcdacea812eb741eb25916a137d6f9d1bcc7704c /server/lib/activitypub
parent109d4a7f017e5ba18045f308158a71399a1b08cd (diff)
downloadPeerTube-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.ts4
-rw-r--r--server/lib/activitypub/videos/shared/abstract-builder.ts8
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'
4import { logger, loggerTagsFactory } from '@server/helpers/logger' 4import { logger, loggerTagsFactory } from '@server/helpers/logger'
5import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants' 5import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants'
6import { sequelizeTypescript } from '@server/initializers/database' 6import { sequelizeTypescript } from '@server/initializers/database'
7import { updatePlaylistMiniatureFromUrl } from '@server/lib/thumbnail' 7import { updateRemotePlaylistMiniatureFromUrl } from '@server/lib/thumbnail'
8import { VideoPlaylistModel } from '@server/models/video/video-playlist' 8import { VideoPlaylistModel } from '@server/models/video/video-playlist'
9import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' 9import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
10import { FilteredModelAttributes } from '@server/types' 10import { 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 @@
1import { CreationAttributes, Transaction } from 'sequelize/types' 1import { CreationAttributes, Transaction } from 'sequelize/types'
2import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils' 2import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils'
3import { logger, LoggerTagsFn } from '@server/helpers/logger' 3import { logger, LoggerTagsFn } from '@server/helpers/logger'
4import { updateRemoteThumbnail } from '@server/lib/thumbnail' 4import { updateRemoteVideoThumbnail } from '@server/lib/thumbnail'
5import { setVideoTags } from '@server/lib/video' 5import { setVideoTags } from '@server/lib/video'
6import { StoryboardModel } from '@server/models/video/storyboard' 6import { StoryboardModel } from '@server/models/video/storyboard'
7import { VideoCaptionModel } from '@server/models/video/video-caption' 7import { 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)