aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-29 14:10:31 +0200
committerChocobozzz <me@florianbigard.com>2019-07-29 14:10:31 +0200
commit6f530096cbceda09377c2e8e235cf02c36226989 (patch)
tree9e15915d8e59ec50f8ae8d5ac4ac315ea54e5c07 /server/tools
parent2284f202070aa2e49156cc52b3b1596a7d5aadec (diff)
downloadPeerTube-6f530096cbceda09377c2e8e235cf02c36226989.tar.gz
PeerTube-6f530096cbceda09377c2e8e235cf02c36226989.tar.zst
PeerTube-6f530096cbceda09377c2e8e235cf02c36226989.zip
Correctly import tags in CLI
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/cli.ts6
-rw-r--r--server/tools/peertube-upload.ts6
2 files changed, 5 insertions, 7 deletions
diff --git a/server/tools/cli.ts b/server/tools/cli.ts
index 67755022c..8599a270f 100644
--- a/server/tools/cli.ts
+++ b/server/tools/cli.ts
@@ -121,7 +121,7 @@ function buildCommonVideoOptions (command: Command) {
121 .option('-w, --wait-transcoding', 'Wait transcoding before publishing the video') 121 .option('-w, --wait-transcoding', 'Wait transcoding before publishing the video')
122} 122}
123 123
124async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any) { 124async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any = {}) {
125 const defaultBooleanAttributes = { 125 const defaultBooleanAttributes = {
126 nsfw: false, 126 nsfw: false,
127 commentsEnabled: true, 127 commentsEnabled: true,
@@ -147,7 +147,9 @@ async function buildVideoAttributesFromCommander (url: string, command: Command,
147 licence: command[ 'licence' ] || defaultAttributes.licence || undefined, 147 licence: command[ 'licence' ] || defaultAttributes.licence || undefined,
148 language: command[ 'language' ] || defaultAttributes.language || undefined, 148 language: command[ 'language' ] || defaultAttributes.language || undefined,
149 privacy: command[ 'privacy' ] || defaultAttributes.privacy || VideoPrivacy.PUBLIC, 149 privacy: command[ 'privacy' ] || defaultAttributes.privacy || VideoPrivacy.PUBLIC,
150 support: command[ 'support' ] || defaultAttributes.support || undefined 150 support: command[ 'support' ] || defaultAttributes.support || undefined,
151 description: command[ 'videoDescription' ] || defaultAttributes.description || undefined,
152 tags: command[ 'tags' ] || defaultAttributes.tags || undefined
151 } 153 }
152 154
153 Object.assign(videoAttributes, booleanAttributes) 155 Object.assign(videoAttributes, booleanAttributes)
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts
index d9f9a8ead..4569cbb85 100644
--- a/server/tools/peertube-upload.ts
+++ b/server/tools/peertube-upload.ts
@@ -46,11 +46,7 @@ async function run (url: string, username: string, password: string) {
46 46
47 console.log('Uploading %s video...', program[ 'videoName' ]) 47 console.log('Uploading %s video...', program[ 'videoName' ])
48 48
49 const defaultAttributes = { 49 const videoAttributes = await buildVideoAttributesFromCommander(url, program)
50 tags: command[ 'tags' ],
51 description: command[ 'videoDescription' ]
52 }
53 const videoAttributes = await buildVideoAttributesFromCommander(url, program, defaultAttributes)
54 50
55 Object.assign(videoAttributes, { 51 Object.assign(videoAttributes, {
56 fixture: program[ 'file' ], 52 fixture: program[ 'file' ],