X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fthumbnail.ts;h=cfee69cfc50df4ad6ef9733357c26f619a87662d;hb=1f256e7d3cf056c2d999260155cdba58ae1b878b;hp=106f5fdaadd158b0bec88651f60e4efe24ef2356;hpb=1ef447bd8397792dc7d1db93dfe87749f0532c72;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts index 106f5fdaa..cfee69cfc 100644 --- a/server/lib/thumbnail.ts +++ b/server/lib/thumbnail.ts @@ -1,7 +1,8 @@ import { join } from 'path' + 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' @@ -11,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 @@ -200,7 +201,7 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si : undefined if (type === ThumbnailType.MINIATURE) { - const filename = video.generateThumbnailName() + const filename = generateImageFilename() 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 = generateImageFilename() const basePath = CONFIG.STORAGE.PREVIEWS_DIR return {