From e3a682a877a10833cb54ac3595e55110bda95647 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 14 Feb 2018 15:33:49 +0100 Subject: Handle thumbnail update --- server/lib/activitypub/process/process-update.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index c0038be64..c7ad412bc 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -11,7 +11,10 @@ import { ActorModel } from '../../../models/activitypub/actor' import { TagModel } from '../../../models/video/tag' import { VideoFileModel } from '../../../models/video/video-file' import { fetchAvatarIfExists, getOrCreateActorAndServerAndModel, updateActorAvatarInstance, updateActorInstance } from '../actor' -import { getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, videoFileActivityUrlToDBAttributes } from '../videos' +import { + generateThumbnailFromUrl, getOrCreateAccountAndVideoAndChannel, videoActivityObjectToDBAttributes, + videoFileActivityUrlToDBAttributes +} from '../videos' async function processUpdateActivity (activity: ActivityUpdate) { const actor = await getOrCreateActorAndServerAndModel(activity.actor) @@ -82,6 +85,10 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { await videoInstance.save(sequelizeOptions) + // Don't block on request + generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon) + .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, err)) + // Remove old video files const videoFileDestroyTasks: Bluebird[] = [] for (const videoFile of videoInstance.VideoFiles) { -- cgit v1.2.3