1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Add torrent tests

This commit is contained in:
Chocobozzz 2018-08-07 15:17:17 +02:00
parent 187501f8b8
commit 3e17515e29
11 changed files with 144 additions and 59 deletions

View file

@ -114,8 +114,8 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
tempVideoPath = await downloader()
// Get information about this video
const { size } = await statPromise(tempVideoPath)
const isAble = await videoImport.User.isAbleToUploadVideo({ size })
const stats = await statPromise(tempVideoPath)
const isAble = await videoImport.User.isAbleToUploadVideo({ size: stats.size })
if (isAble === false) {
throw new Error('The user video quota is exceeded with this video to import.')
}
@ -128,7 +128,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
const videoFileData = {
extname: extname(tempVideoPath),
resolution: videoFileResolution,
size,
size: stats.size,
fps,
videoId: videoImport.videoId
}
@ -209,7 +209,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
} catch (err) {
try {
if (tempVideoPath) await unlinkPromise(tempVideoPath)
// if (tempVideoPath) await unlinkPromise(tempVideoPath)
} catch (errUnlink) {
logger.warn('Cannot cleanup files after a video import error.', { err: errUnlink })
}