]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/real-world/tools/upload.js
856251c7fd9b8fc87ed3af119fe61667c37f5a8f
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, --category <category number>', 'Category number')
13 .option('-d, --description <description>', 'Video description')
14 .option('-t, --tags <tags>', 'Video tags', list
)
15 .option('-f, --file <file>', 'Video absolute file path')
20 !program
.accessToken
||
23 !program
.description
||
25 !Array
.isArray(program
.tags
) ||
26 program
.tags
.length
=== 0 ||
29 throw new Error('All arguments are required.')
32 fs
.access(program
.file
, fs
.F_OK
, function (err
) {
46 // ----------------------------------------------------------------------------
52 function upload (url
, accessToken
, name
, category
, description
, tags
, fixture
) {
53 console
.log('Uploading %s video...', program
.name
)
55 const videoAttributes
= {
62 utils
.uploadVideo(url
, accessToken
, videoAttributes
, function (err
) {
65 console
.log('Video uploaded.')