]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/real-world/tools/upload.js
3 const program
= require('commander')
4 const fs
= require('fs')
6 const utils
= require('../../utils/videos')
9 .option('-u, --url <url>', 'Server url')
10 .option('-a, --access-token <token>', 'Access token')
11 .option('-n, --name <name>', 'Video name')
12 .option('-d, --description <description>', 'Video description')
13 .option('-t, --tags <tags>', 'Video tags', list
)
14 .option('-f, --file <file>', 'Video absolute file path')
19 !program
.accessToken
||
21 !program
.description
||
23 !Array
.isArray(program
.tags
) ||
24 program
.tags
.length
=== 0 ||
27 throw new Error('All arguments are required.')
30 fs
.access(program
.file
, fs
.F_OK
, function (err
) {
43 // ----------------------------------------------------------------------------
49 function upload (url
, accessToken
, name
, description
, tags
, file
) {
50 console
.log('Uploading %s video...', program
.name
)
52 utils
.uploadVideo(url
, accessToken
, name
, description
, tags
, file
, function (err
) {
55 console
.log('Video uploaded.')