X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fthumbnail.ts;h=78d2f69e39bcf45b69f500a125b918ac9ca3f247;hb=963023abe6acf31799f6474d78489c8013f664fa;hp=a99f716290accecf0dc89fd038966cdd8323a7c9;hpb=d7a25329f9e607894d29ab342b9cb66638b56dc0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts index a99f71629..78d2f69e3 100644 --- a/server/lib/thumbnail.ts +++ b/server/lib/thumbnail.ts @@ -6,9 +6,9 @@ import { ThumbnailType } from '../../shared/models/videos/thumbnail.type' import { processImage } from '../helpers/image-utils' import { join } from 'path' import { downloadImage } from '../helpers/requests' -import { MVideoPlaylistThumbnail } from '../typings/models/video/video-playlist' -import { MVideoFile, MVideoThumbnail } from '../typings/models' -import { MThumbnail } from '../typings/models/video/thumbnail' +import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist' +import { MVideoFile, MVideoThumbnail } from '../types/models' +import { MThumbnail } from '../types/models/video/thumbnail' import { getVideoFilePath } from './video-paths' type ImageSize = { height: number, width: number } @@ -69,7 +69,7 @@ function generateVideoMiniature (video: MVideoThumbnail, videoFile: MVideoFile, function createPlaceholderThumbnail (fileUrl: string, video: MVideoThumbnail, type: ThumbnailType, size: ImageSize) { const { filename, height, width, existingThumbnail } = buildMetadataFromVideo(video, type, size) - const thumbnail = existingThumbnail ? existingThumbnail : new ThumbnailModel() + const thumbnail = existingThumbnail || new ThumbnailModel() thumbnail.filename = filename thumbnail.height = height @@ -142,18 +142,18 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si } async function createThumbnailFromFunction (parameters: { - thumbnailCreator: () => Promise, - filename: string, - height: number, - width: number, - type: ThumbnailType, - automaticallyGenerated?: boolean, - fileUrl?: string, + thumbnailCreator: () => Promise + filename: string + height: number + width: number + type: ThumbnailType + automaticallyGenerated?: boolean + fileUrl?: string existingThumbnail?: MThumbnail }) { const { thumbnailCreator, filename, width, height, type, existingThumbnail, automaticallyGenerated = null, fileUrl = null } = parameters - const thumbnail = existingThumbnail ? existingThumbnail : new ThumbnailModel() + const thumbnail = existingThumbnail || new ThumbnailModel() thumbnail.filename = filename thumbnail.height = height