def onUploadSuccess(self, filePath, jid, url): #convenience method to detect file/image attributes for sending, requires existence of 'pillow' library print("Upload success") entity = OutgoingChatstateProtocolEntity(ChatstateProtocolEntity.STATE_TYPING, jid) self.toLower(entity) entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, jid) self.toLower(entity)
def imageSend(self, filePath, url, to, ip=None, caption=None): # create the entity object to be passed down entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, ip, to, caption=caption) logger.debug('Sending image %s to %s' %(url, to)) self.toLower(entity)
def imageSend(self, filePath, url, to, ip=None, caption=None): # create the entity object to be passed down entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, ip, to, caption=caption) logger.debug('Sending image %s to %s' % (url, to)) self.toLower(entity)
def onUploadSuccess(self, filePath, jid, url): #convenience method to detect file/image attributes for sending, requires existence of 'pillow' library logging.info("Upload success") entity = OutgoingChatstateProtocolEntity( ChatstateProtocolEntity.STATE_TYPING, jid) self.toLower(entity) entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, None, jid) self.toLower(entity)
def send_file(self, file_path, url, to, ip=None): filename, extension = os.path.splitext(file_path) entity = None if extension in EXT_IMAGE: entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to) elif extension in EXT_VIDEO: entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "video", ip, to) elif extension in EXT_AUDIO: entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "audio", ip, to) if entity: self.toLower(entity)
def send_file(self, file_path, url, to, ip=None): filename, extension = os.path.splitext(file_path) entity = None if extension in EXT_IMAGE: entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to) elif extension in EXT_VIDEO: entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "video", ip, to) elif extension in EXT_AUDIO: entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "audio", ip, to) if entity: self.toLower(entity)
def sendMediaForReal(x): result, url = x print("Sending for real now") ip = result.getIp() if mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE: entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( path, url, ip, jid, caption=caption) elif mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_AUDIO: entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath( path, url, ip, jid) elif mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_VIDEO: entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath( path, url, ip, jid, caption=caption) if not entity: raise ValueError() self.toLower(entity)
def send_uploaded_media(self, fpath, jid, url, ip = None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( fpath, url, ip, jid) if not args.dry: self.stack.execDetached(self.stack.send(entity))
def send_uploaded_media(self, fpath, jid, url, ip=None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( fpath, url, ip, jid) if not args.dry: self.stack.execDetached(self.stack.send(entity))
def doSendImage(self, filePath, url, to, ip = "127.0.0.1", caption = None): logger.info('filepath:%s url:%s to:%s ip:%s caption:%s ' % (filePath, url, to, ip, caption)) entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, ip, to, caption = caption) self.toLower(entity)
def doSendImage(self, filePath, url, to, ip=None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, ip, to) self.toLower(entity)
def onUploadError(self, filePath, jid, url): print("Upload file failed!") print(ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, jid))
def doSendImage(self,filePath,url,to,ip=None): entity=ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath,url,ip,to) self.toLower(entity)
def onUploadError(self, filePath, jid, url): logging.info("Upload file failed!") logging.info( ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, None, jid))
def doSendImage(self, filePath, url, to, ip="127.0.0.1", caption=None): logger.info('filepath:%s url:%s to:%s ip:%s caption:%s ' % (filePath, url, to, ip, caption)) entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( filePath, url, ip, to, caption=caption) self.toLower(entity)
def send_uploaded_media(self, fpath, jid, url, ip=None): entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath( fpath, url, ip, jid) if not args.dry: self._yowsup.toLower(entity)
def onUploadSuccess(self, filePath, receiver_jid, url): #convenience method to detect file/image attributes for sending, requires existence of 'pillow' library entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, receiver_jid) self.toLower(entity)