1
0
Fork 0

Fix re webtorrent transcoding

This commit is contained in:
Chocobozzz 2020-09-09 10:14:33 +02:00
parent b43d19cf44
commit fb0f7f82e5
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -234,7 +234,7 @@ async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoF
const fps = await getVideoFileFPS(transcodingPath) const fps = await getVideoFileFPS(transcodingPath)
const metadata = await getMetadataFromFile(transcodingPath) const metadata = await getMetadataFromFile(transcodingPath)
await move(transcodingPath, outputPath) await move(transcodingPath, outputPath, { overwrite: true })
videoFile.size = stats.size videoFile.size = stats.size
videoFile.fps = fps videoFile.fps = fps
@ -242,12 +242,8 @@ async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoF
await createTorrentAndSetInfoHash(video, videoFile) await createTorrentAndSetInfoHash(video, videoFile)
const updatedVideoFile = await videoFile.save() await VideoFileModel.customUpsert(videoFile, 'video', undefined)
video.VideoFiles = await video.$get('VideoFiles')
// Add it if this is a new created file
if (video.VideoFiles.some(f => f.id === videoFile.id) === false) {
video.VideoFiles.push(updatedVideoFile)
}
return video return video
} }