From 53d4db2a8a11407165da6525cad3198439686d36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 19 Jun 2023 09:56:12 +0200 Subject: Fix playlist thumbnail generation --- server/lib/activitypub/playlists/create-update.ts | 4 ++-- server/lib/activitypub/videos/shared/abstract-builder.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'server/lib/activitypub') 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' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants' import { sequelizeTypescript } from '@server/initializers/database' -import { updatePlaylistMiniatureFromUrl } from '@server/lib/thumbnail' +import { updateRemotePlaylistMiniatureFromUrl } from '@server/lib/thumbnail' import { VideoPlaylistModel } from '@server/models/video/video-playlist' import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' import { FilteredModelAttributes } from '@server/types' @@ -104,7 +104,7 @@ async function updatePlaylistThumbnail (playlistObject: PlaylistObject, playlist let thumbnailModel: MThumbnail try { - thumbnailModel = await updatePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist }) + thumbnailModel = await updateRemotePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist }) await playlist.setAndSaveThumbnail(thumbnailModel, undefined) } catch (err) { 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 @@ import { CreationAttributes, Transaction } from 'sequelize/types' import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils' import { logger, LoggerTagsFn } from '@server/helpers/logger' -import { updateRemoteThumbnail } from '@server/lib/thumbnail' +import { updateRemoteVideoThumbnail } from '@server/lib/thumbnail' import { setVideoTags } from '@server/lib/video' import { StoryboardModel } from '@server/models/video/storyboard' import { VideoCaptionModel } from '@server/models/video/video-caption' @@ -48,7 +48,7 @@ export abstract class APVideoAbstractBuilder { return undefined } - const miniatureModel = updateRemoteThumbnail({ + const miniatureModel = updateRemoteVideoThumbnail({ fileUrl: miniatureIcon.url, video, type: ThumbnailType.MINIATURE, @@ -63,12 +63,12 @@ export abstract class APVideoAbstractBuilder { const previewIcon = getPreviewFromIcons(this.videoObject) if (!previewIcon) return - const previewModel = updateRemoteThumbnail({ + const previewModel = updateRemoteVideoThumbnail({ fileUrl: previewIcon.url, video, type: ThumbnailType.PREVIEW, size: previewIcon, - onDisk: false // Don't fetch the preview that could be big, create a placeholder instead + onDisk: false // Lazy download remote previews }) await video.addAndSaveThumbnail(previewModel, t) -- cgit v1.2.3