-
Notifications
You must be signed in to change notification settings - Fork 115
/
video.ts
33 lines (30 loc) · 1004 Bytes
/
video.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { formatBalance } from '@polkadot/util'
import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
import { displayCollapsedRow } from '../../helpers/display'
export default class VideoCommand extends ContentDirectoryCommandBase {
static description = 'Show Video details by id.'
static args = [
{
name: 'videoId',
required: true,
description: 'ID of the Video',
},
]
static flags = {
...ContentDirectoryCommandBase.flags,
}
async run(): Promise<void> {
const { videoId } = this.parse(VideoCommand).args
const aVideo = await this.getApi().videoById(videoId)
if (aVideo) {
displayCollapsedRow({
'ID': videoId.toString(),
'InChannel': aVideo.inChannel.toString(),
'VideoStateBloatBond': formatBalance(aVideo.videoStateBloatBond.amount),
'DataObjects': aVideo.dataObjects.toString(),
})
} else {
this.error(`Video not found by channel id: "${videoId}"!`)
}
}
}