mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Introduce videos command
This commit is contained in:
parent
7926c5f9b3
commit
d23dd9fbfc
108 changed files with 2484 additions and 3100 deletions
|
@ -4,7 +4,6 @@ registerTSPaths()
|
|||
import { program } from 'commander'
|
||||
import { access, constants } from 'fs-extra'
|
||||
import { isAbsolute } from 'path'
|
||||
import { uploadVideo } from '../../shared/extra-utils/'
|
||||
import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './cli'
|
||||
|
||||
let command = program
|
||||
|
@ -52,16 +51,18 @@ async function run (url: string, username: string, password: string) {
|
|||
|
||||
console.log('Uploading %s video...', options.videoName)
|
||||
|
||||
const videoAttributes = await buildVideoAttributesFromCommander(server, program)
|
||||
const baseAttributes = await buildVideoAttributesFromCommander(server, program)
|
||||
|
||||
const attributes = {
|
||||
...baseAttributes,
|
||||
|
||||
Object.assign(videoAttributes, {
|
||||
fixture: options.file,
|
||||
thumbnailfile: options.thumbnail,
|
||||
previewfile: options.preview
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
await uploadVideo(url, server.accessToken, videoAttributes)
|
||||
await server.videosCommand.upload({ attributes })
|
||||
console.log(`Video ${options.videoName} uploaded.`)
|
||||
process.exit(0)
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue