1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Remove previous thumbnail if needed

This commit is contained in:
Chocobozzz 2021-02-16 08:50:40 +01:00 committed by Chocobozzz
parent 6302d599cd
commit a35a22797c
15 changed files with 274 additions and 119 deletions

View file

@ -173,7 +173,11 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) {
const thumbnailField = req.files['thumbnailfile']
const thumbnailModel = thumbnailField
? await createPlaylistMiniatureFromExisting(thumbnailField[0].path, videoPlaylist, false)
? await createPlaylistMiniatureFromExisting({
inputPath: thumbnailField[0].path,
playlist: videoPlaylist,
automaticallyGenerated: false
})
: undefined
const videoPlaylistCreated = await sequelizeTypescript.transaction(async t => {
@ -211,7 +215,11 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
const thumbnailField = req.files['thumbnailfile']
const thumbnailModel = thumbnailField
? await createPlaylistMiniatureFromExisting(thumbnailField[0].path, videoPlaylistInstance, false)
? await createPlaylistMiniatureFromExisting({
inputPath: thumbnailField[0].path,
playlist: videoPlaylistInstance,
automaticallyGenerated: false
})
: undefined
try {
@ -474,7 +482,12 @@ async function generateThumbnailForPlaylist (videoPlaylist: MVideoPlaylistThumbn
}
const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, videoMiniature.filename)
const thumbnailModel = await createPlaylistMiniatureFromExisting(inputPath, videoPlaylist, true, true)
const thumbnailModel = await createPlaylistMiniatureFromExisting({
inputPath,
playlist: videoPlaylist,
automaticallyGenerated: true,
keepOriginal: true
})
thumbnailModel.videoPlaylistId = videoPlaylist.id