aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-import-videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 14:09:23 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 14:09:23 +0100
commitb718fd22374d64534bcfe69932cf562894abed6a (patch)
tree311d3c67e2a4d1f33ebdd1dc163527de9d33d0f7 /server/tools/peertube-import-videos.ts
parentadb115f5522bea4d52456a9fc5eb4140bb064476 (diff)
parent501e961199578129629cf0567033d13efced9904 (diff)
downloadPeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.gz
PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.zst
PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.zip
Merge branch 'develop' into pr/1285
Diffstat (limited to 'server/tools/peertube-import-videos.ts')
-rw-r--r--server/tools/peertube-import-videos.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 2874a2131..151c5a989 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -78,7 +78,11 @@ getSettings()
78 password: program['password'] 78 password: program['password']
79 } 79 }
80 80
81 run(user, program['url']).catch(err => console.error(err)) 81 run(user, program['url'])
82 .catch(err => {
83 console.error(err)
84 process.exit(-1)
85 })
82}) 86})
83 87
84async function promptPassword () { 88async function promptPassword () {
@@ -112,8 +116,12 @@ async function run (user, url: string) {
112 secret: res.body.client_secret 116 secret: res.body.client_secret
113 } 117 }
114 118
115 const res2 = await login(url, client, user) 119 try {
116 accessToken = res2.body.access_token 120 const res = await login(program[ 'url' ], client, user)
121 accessToken = res.body.access_token
122 } catch (err) {
123 throw new Error('Cannot authenticate. Please check your username/password.')
124 }
117 125
118 const youtubeDL = await safeGetYoutubeDL() 126 const youtubeDL = await safeGetYoutubeDL()
119 127
@@ -216,6 +224,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st
216 nsfw: isNSFW(videoInfo), 224 nsfw: isNSFW(videoInfo),
217 waitTranscoding: true, 225 waitTranscoding: true,
218 commentsEnabled: true, 226 commentsEnabled: true,
227 downloadEnabled: true,
219 description: videoInfo.description || undefined, 228 description: videoInfo.description || undefined,
220 support: undefined, 229 support: undefined,
221 tags, 230 tags,