pyzenbo.modules.media module

class pyzenbo.modules.media.Media(inter_comm)

Bases: object

take_picture(sync=True, timeout=None)

Take picture.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

record_video(duration, sync=True, timeout=None)

Record video.

Parameters
  • duration – the time during record video in seconds

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

stop_record_video(sync=True, timeout=None)

Stop record video.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

record_audio(duration, sync=True, timeout=None)

Record audio.

Parameters
  • duration – the time during record video in seconds

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

stop_record_audio(sync=True, timeout=None)

Stop record audio.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

play_media(file_path, file_name, sync=True, timeout=None)

Play media.

Parameters
  • file_path – file path in Zenbo junior storage

  • file_name – file name in Zenbo junior storage

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

stop_media(file_path='', file_name='', sync=True, timeout=None)

Stop play media. If file_path and file_name are empty strings, all play media will be stopped.

Parameters
  • file_path – file path in Zenbo junior storage

  • file_name – file name in Zenbo junior storage

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

get_file_list(sync=True, timeout=None)

Get media file list store in Zenbo lab.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

file_transmission(target_file, over_write=False)

Media file transfer, this file will store in working directory.

Parameters
  • target_file – target file name

  • over_write – overwrite existing file

Returns

file name and file size if transfer success, otherwise return error message (‘EXIST_FILE_NAME’ or ‘WRONG_FILE_NAME’) and 0