def send_file(self, filePath, address): # send to server (aka on my laptop) #transmitOne(filePath,'137.54.51.83',self.send_port) #transmitOne(filePath,port=self.send_port,address='localhost') #transmitOne(filePath, 'localhost',self.send_port) port = self.send_port if "MOV;" in filePath: moveMessage.sendFile(filePath, address, port) else: controller = type('test',(object,),{'cancel':False, 'total_sent':0,'completed':Deferred()}) f = FileIOClientFactory(filePath, controller) reactor.connectTCP(address, port, f) return controller.completed
def send_file(self, filePath, address): # send to server (aka on my laptop) # transmitOne(filePath,'137.54.51.83',self.send_port) # transmitOne(filePath,port=self.send_port,address='localhost') # transmitOne(filePath, 'localhost',self.send_port) port = self.send_port if "MOV;" in filePath: moveMessage.sendFile(filePath, address, port) else: if ".enc" not in filePath: fileCrypto.encrypt_file("somekey", filePath) filePath = filePath + ".enc" controller = type("test", (object,), {"cancel": False, "total_sent": 0, "completed": Deferred()}) f = FileIOClientFactory(filePath, controller) reactor.connectTCP(address, port, f) os.remove(filePath) return controller.completed
def transmitDelete(self, source): moveMessage.sendFile(source,self.address,self.port) print 'Dialing on port',self.port,'..' reactor.run(installSignalHandlers=0)