mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Refactor video creation
This commit is contained in:
parent
c6c0fa6cd8
commit
1ef65f4c03
6 changed files with 152 additions and 133 deletions
|
@ -42,15 +42,18 @@ function createVideoMiniatureFromUrl (fileUrl: string, video: MVideoThumbnail, t
|
|||
return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, existingThumbnail, fileUrl })
|
||||
}
|
||||
|
||||
function createVideoMiniatureFromExisting (
|
||||
inputPath: string,
|
||||
video: MVideoThumbnail,
|
||||
type: ThumbnailType,
|
||||
automaticallyGenerated: boolean,
|
||||
function createVideoMiniatureFromExisting (options: {
|
||||
inputPath: string
|
||||
video: MVideoThumbnail
|
||||
type: ThumbnailType
|
||||
automaticallyGenerated: boolean
|
||||
size?: ImageSize
|
||||
) {
|
||||
keepOriginal?: boolean
|
||||
}) {
|
||||
const { inputPath, video, type, automaticallyGenerated, size, keepOriginal } = options
|
||||
|
||||
const { filename, outputPath, height, width, existingThumbnail } = buildMetadataFromVideo(video, type, size)
|
||||
const thumbnailCreator = () => processImage(inputPath, outputPath, { width, height })
|
||||
const thumbnailCreator = () => processImage(inputPath, outputPath, { width, height }, keepOriginal)
|
||||
|
||||
return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, automaticallyGenerated, existingThumbnail })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue