예제 #1
0
 def _do_send_file(self, media_path, url, to, ip=None, caption=None):
     """
         Now the media file has been uploaded and the whatsapp server returns a media_path.
         The media_path is then sent to the receipt.
     """
     entity = None
     if self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO:
         entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(media_path, url, self.MEDIA_TYPE, ip, to)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_IMAGE:
         entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(media_path, url, ip, to, caption=caption)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_AUDIO:
         entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(media_path, url, ip, to)
     self.interface_layer.toLower(entity)
예제 #2
0
 def _do_send_file(self, file_path, url, to, ip=None, caption=None):
     """
         Now the media file has been uploaded and the whatsapp server returns a media_path.
         The media_path is then sent to the receipt.
     """
     entity = None
     if self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_VIDEO:
         entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, self.MEDIA_TYPE, ip, to)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_IMAGE:
         entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to, caption=caption)
     elif self.MEDIA_TYPE == DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_AUDIO:
         entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to)
     self.interface_layer.toLower(entity)
예제 #3
0
def audio_downloadable_media_message_protocol_entity(url="url", to="341234567", ip="ip", caption="image caption"):
    attributes = {
        "mimeType": DownloadableMediaMessageProtocolEntity.MEDIA_TYPE_AUDIO,
        "fileHash": "filehash",
        "url": url,
        "ip": ip,
        "size": "1234",
        "fileName": "audio.mp3",
        "abitrate": "arbitrate",
        "acodec": "acodec",
        "asampfreq": "asampfreq",
        "duration": "10",
        "origin": "origin",
        "seconds": "100",        
        "encoding": "encoding",
        "to": to
    }
    return AudioDownloadableMediaMessageProtocolEntity(**attributes)
예제 #4
0
 def do_send_audio(self, file_path, url, to, ip=None, caption=None):
     entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(
         file_path, url, ip, to)
     self.toLower(entity)
예제 #5
0
 def do_send_audio(self, file_path, url, to, ip=None, caption=None):
     entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to)
     self.toLower(entity)