@@ -342,6 +342,58 @@ def send_image(ctx, **arguments):
342
342
click .echo ((yield from message .send ()))
343
343
344
344
345
+ @cli .command (short_help = 'Send a video using end-to-end mode.' , help = """
346
+ Encrypt and send a video ('mp4') including a thumbnail to the given ID.
347
+ FROM is the API identity and SECRET is the API secret.
348
+ VIDEO_PATH is a relative or absolute path to a video.
349
+ THUMBNAIL_PATH is a relative or absolute path to a thumbnail.
350
+ Prints the message ID on success.
351
+ """ )
352
+ @click .argument ('to' )
353
+ @click .argument ('from' )
354
+ @click .argument ('secret' )
355
+ @click .argument ('private_key' )
356
+ @click .argument ('video_path' )
357
+ @click .argument ('thumbnail_path' )
358
+ @click .option ('-k' , '--public-key' , help = """
359
+ The public key of the recipient. Will be fetched automatically if not provided.
360
+ """ )
361
+ @click .option ('-d' , '--duration' , help = """
362
+ Duration of the video in seconds. Defaults to 0.
363
+ """ , default = 0 )
364
+ @click .pass_context
365
+ @util .aio_run_decorator ()
366
+ def send_video (ctx , ** arguments ):
367
+ # Get key instances
368
+ private_key = util .read_key_or_key_file (arguments ['private_key' ], Key .Type .private )
369
+ if arguments ['public_key' ] is not None :
370
+ public_key = util .read_key_or_key_file (arguments ['public_key' ], Key .Type .public )
371
+ else :
372
+ public_key = None
373
+
374
+ # Create connection
375
+ connection = Connection (
376
+ identity = arguments ['from' ],
377
+ secret = arguments ['secret' ],
378
+ key = private_key ,
379
+ ** ctx .obj
380
+ )
381
+
382
+ with connection :
383
+ # Create message
384
+ message = e2e .VideoMessage (
385
+ connection = connection ,
386
+ to_id = arguments ['to' ],
387
+ key = public_key ,
388
+ duration = arguments ['duration' ],
389
+ video_path = arguments ['video_path' ],
390
+ thumbnail_path = arguments ['thumbnail_path' ]
391
+ )
392
+
393
+ # Send message
394
+ click .echo ((yield from message .send ()))
395
+
396
+
345
397
@cli .command (short_help = 'Send a file using end-to-end mode.' , help = """
346
398
Encrypt and send a file to the given ID, optionally with a thumbnail.
347
399
FROM is the API identity and SECRET is the API secret.
0 commit comments