From a0eeb45f14bab539f505861cad8f5d42d9ba30cb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Apr 2021 10:35:49 +0200 Subject: Update data in DB when regenerate thumbnails --- server/lib/activitypub/videos.ts | 3 ++- server/lib/thumbnail.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'server/lib') diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index d484edd36..492b97b9e 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -3,6 +3,7 @@ import { maxBy, minBy } from 'lodash' import * as magnetUtil from 'magnet-uri' import { basename, join } from 'path' import { Transaction } from 'sequelize/types' +import { ActorImageModel } from '@server/models/account/actor-image' import { TrackerModel } from '@server/models/server/tracker' import { VideoLiveModel } from '@server/models/video/video-live' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' @@ -899,7 +900,7 @@ function getPreviewFromIcons (videoObject: VideoObject) { function getPreviewUrl (previewIcon: ActivityIconObject, video: MVideoWithHost) { return previewIcon ? previewIcon.url - : buildRemoteVideoBaseUrl(video, join(LAZY_STATIC_PATHS.PREVIEWS, video.generatePreviewName())) + : buildRemoteVideoBaseUrl(video, join(LAZY_STATIC_PATHS.PREVIEWS, ActorImageModel.generateFilename())) } function getTrackerUrls (object: VideoObject, video: MVideoWithHost) { diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts index 106f5fdaa..e1176ac08 100644 --- a/server/lib/thumbnail.ts +++ b/server/lib/thumbnail.ts @@ -1,4 +1,5 @@ import { join } from 'path' +import { ActorImageModel } from '@server/models/account/actor-image' import { ThumbnailType } from '../../shared/models/videos/thumbnail.type' import { generateImageFromVideoFile } from '../helpers/ffmpeg-utils' import { processImage } from '../helpers/image-utils' @@ -200,7 +201,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si : undefined if (type === ThumbnailType.MINIATURE) { - const filename = video.generateThumbnailName() + const filename = ActorImageModel.generateFilename() const basePath = CONFIG.STORAGE.THUMBNAILS_DIR return { @@ -214,7 +215,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si } if (type === ThumbnailType.PREVIEW) { - const filename = video.generatePreviewName() + const filename = ActorImageModel.generateFilename() const basePath = CONFIG.STORAGE.PREVIEWS_DIR return { -- cgit v1.2.3