X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fthumbnail.ts;h=cfee69cfc50df4ad6ef9733357c26f619a87662d;hb=1f256e7d3cf056c2d999260155cdba58ae1b878b;hp=e1176ac08883dcacfe8172cd6bccef679f79f98d;hpb=a0eeb45f14bab539f505861cad8f5d42d9ba30cb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts index e1176ac08..cfee69cfc 100644 --- a/server/lib/thumbnail.ts +++ b/server/lib/thumbnail.ts @@ -1,8 +1,8 @@ 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' +import { generateImageFilename, processImage } from '../helpers/image-utils' import { downloadImage } from '../helpers/requests' import { CONFIG } from '../initializers/config' import { ASSETS_PATH, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '../initializers/constants' @@ -12,7 +12,7 @@ import { MThumbnail } from '../types/models/video/thumbnail' import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist' import { getVideoFilePath } from './video-paths' -type ImageSize = { height: number, width: number } +type ImageSize = { height?: number, width?: number } function createPlaylistMiniatureFromExisting (options: { inputPath: string @@ -201,7 +201,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si : undefined if (type === ThumbnailType.MINIATURE) { - const filename = ActorImageModel.generateFilename() + const filename = generateImageFilename() const basePath = CONFIG.STORAGE.THUMBNAILS_DIR return { @@ -215,7 +215,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si } if (type === ThumbnailType.PREVIEW) { - const filename = ActorImageModel.generateFilename() + const filename = generateImageFilename() const basePath = CONFIG.STORAGE.PREVIEWS_DIR return {