]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-upload.ts
Add server migrations
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-upload.ts
index 4034b7e38051102ff4aeacdc6c74ca3270bb4c92..ebc62c96512ce6a6c2b7aaa65fe41130c3f9f980 100644 (file)
@@ -1,8 +1,8 @@
 import * as program from 'commander'
 import { access, constants } from 'fs-extra'
 import { isAbsolute } from 'path'
-import { getClient, login } from '../tests/utils'
-import { uploadVideo } from '../tests/utils/index'
+import { getClient, login } from '../../shared/utils'
+import { uploadVideo } from '../../shared/utils/'
 import { VideoPrivacy } from '../../shared/models/videos'
 import { netrc, getSettings } from './cli'
 
@@ -30,6 +30,7 @@ if (!program['tags']) program['tags'] = []
 if (!program['nsfw']) program['nsfw'] = false
 if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC
 if (!program['commentsEnabled']) program['commentsEnabled'] = false
+if (!program['downloadEnabled']) program['downloadEnabled'] = true
 
 getSettings()
   .then(settings => {
@@ -106,15 +107,17 @@ async function run () {
 
   console.log('Uploading %s video...', program[ 'videoName' ])
 
-  let videoAttributes:any = {
+  const videoAttributes = {
     name: program['videoName'],
     category: program['category'],
+    channelId: program['channelId'],
     licence: program['licence'],
     language: program['language'],
     nsfw: program['nsfw'],
     description: program['videoDescription'],
     tags: program['tags'],
     commentsEnabled: program['commentsEnabled'],
+    downloadEnabled: program['downloadEnabled'],
     fixture: program['file'],
     thumbnailfile: program['thumbnail'],
     previewfile: program['preview'],
@@ -123,10 +126,6 @@ async function run () {
     support: undefined
   }
 
-  if (program['channelId']) {
-    videoAttributes.channelId = program['channelId']
-  }
-
   await uploadVideo(program[ 'url' ], accessToken, videoAttributes)
 
   console.log(`Video ${program['videoName']} uploaded.`)