Let people choose max and min clip duration

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-05-24 19:17:40 +02:00
parent 082ad9f572
commit 81c179c39c

View file

@ -100,12 +100,16 @@ class ytpCommand extends Command {
{ {
id: 'link', id: 'link',
type: 'string' type: 'string'
},
{
id: 'max',
type: 'string'
} }
], ],
description: { description: {
content: 'Generate random ytp | --add with a link or attachment to add a video to the pool, only .mp4 work | --pool to see how many vid there is currently in the pool | --force to make the command work outside of nsfw channel BE AWARE THAT IT WON\'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN', content: 'Generate random ytp | --add with a link or attachment to add a video to the pool, only .mp4 work | --pool to see how many vid there is currently in the pool | --force to make the command work outside of nsfw channel BE AWARE THAT IT WON\'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN',
usage: '', usage: '(OPTIONAL) | [Minimum length of clip] [Max length of clip]',
examples: [''] examples: ['5 10']
} }
}); });
} }
@ -209,7 +213,8 @@ class ytpCommand extends Command {
let options = { let options = {
debug: args.debug, debug: args.debug,
MAX_STREAM_DURATION: args.link ? args.link : Math.floor((Math.random() * 3) + 1), // Random duration of video clip MIN_STREAM_DURATION: args.link ? Math.floor(args.link) : null,
MAX_STREAM_DURATION: args.max ? args.max : Math.floor(args.link * 1.5),
sources: './asset/ytp/sources/', sources: './asset/ytp/sources/',
sounds: './asset/ytp/sounds/', sounds: './asset/ytp/sounds/',
music: './asset/ytp/music/', music: './asset/ytp/music/',