aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-upload.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-15 10:02:54 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch)
treeda82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tools/peertube-upload.ts
parent7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff)
downloadPeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip
Introduce videos command
Diffstat (limited to 'server/tools/peertube-upload.ts')
-rw-r--r--server/tools/peertube-upload.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts
index c94b05857..597137e4c 100644
--- a/server/tools/peertube-upload.ts
+++ b/server/tools/peertube-upload.ts
@@ -4,7 +4,6 @@ registerTSPaths()
4import { program } from 'commander' 4import { program } from 'commander'
5import { access, constants } from 'fs-extra' 5import { access, constants } from 'fs-extra'
6import { isAbsolute } from 'path' 6import { isAbsolute } from 'path'
7import { uploadVideo } from '../../shared/extra-utils/'
8import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli' 7import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli'
9 8
10let command = program 9let command = program
@@ -52,16 +51,18 @@ async function run (url: string, username: string, password: string) {
52 51
53 console.log('Uploading %s video...', options.videoName) 52 console.log('Uploading %s video...', options.videoName)
54 53
55 const videoAttributes = await buildVideoAttributesFromCommander(server, program) 54 const baseAttributes = await buildVideoAttributesFromCommander(server, program)
55
56 const attributes = {
57 ...baseAttributes,
56 58
57 Object.assign(videoAttributes, {
58 fixture: options.file, 59 fixture: options.file,
59 thumbnailfile: options.thumbnail, 60 thumbnailfile: options.thumbnail,
60 previewfile: options.preview 61 previewfile: options.preview
61 }) 62 }
62 63
63 try { 64 try {
64 await uploadVideo(url, server.accessToken, videoAttributes) 65 await server.videosCommand.upload({ attributes })
65 console.log(`Video ${options.videoName} uploaded.`) 66 console.log(`Video ${options.videoName} uploaded.`)
66 process.exit(0) 67 process.exit(0)
67 } catch (err) { 68 } catch (err) {