From fb0f7f82e59c7138b5fa9d801296609b1c0cd971 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 Sep 2020 10:14:33 +0200 Subject: Fix re webtorrent transcoding --- server/lib/video-transcoding.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index 628f22f5e..5a2dbc9f7 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -234,7 +234,7 @@ async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoF const fps = await getVideoFileFPS(transcodingPath) const metadata = await getMetadataFromFile(transcodingPath) - await move(transcodingPath, outputPath) + await move(transcodingPath, outputPath, { overwrite: true }) videoFile.size = stats.size videoFile.fps = fps @@ -242,12 +242,8 @@ async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoF await createTorrentAndSetInfoHash(video, videoFile) - const updatedVideoFile = await videoFile.save() - - // Add it if this is a new created file - if (video.VideoFiles.some(f => f.id === videoFile.id) === false) { - video.VideoFiles.push(updatedVideoFile) - } + await VideoFileModel.customUpsert(videoFile, 'video', undefined) + video.VideoFiles = await video.$get('VideoFiles') return video } -- cgit v1.2.3