def startAutoSync(item): # Start metadata replication res = db.view("device/all") for device in res: device = device.value url = device['url'] pwd = device['password'] name = device['login'] idDevice = device['_id'] replication.replicate_to_local(url, name, pwd, idDevice) replication.replicate_from_local(url, name, pwd, idDevice) # Start binaries synchronisation download = Process(target=download_binary.main) download.start() stop.show() autoSync.hide()
def configure(self, url, pwd, name, req): ''' Configure cozy-files url {string}: cozy url pwd {string}: cozy password name {string}: device name req {object}: response of request to add device in cozy ''' self.max_prog = 0.1 self._display_error("") init_database() self.max_prog = 0.15 data = json.loads(req.content) repli = replicate_to_local_one_shot_without_deleted(url, name, data['password'], data['id']) self.max_prog = 0.30 replicate_to_local_start_seq(url, name, data['password'], data['id'], repli['source_last_seq']) self.max_prog = 0.98 err = init_device(url, data['password'], data['id']) if err: self._display_error(err) return replicate_from_local(url, name, data['password'], data['id']) pass
replications = json.loads(request.content) if len(replications) is 0: res = db.view("device/all") try: for device in res: device = device.value url = device['url'] pwd = device['password'] name = device['login'] print "Start replication for device located at %s" % url idDevice = device['_id'] replication.replicate_to_local(url, name, pwd, idDevice) replication.replicate_from_local(url, name, pwd, idDevice) except ResourceNotFound: print 'No connected device found' print 'Check that a device is registered in your local CouchDB' \ 'instance' sys.exit(1) # Start binaries synchronisation download = Process(target=download_binary.main) download.start() start_prog() except Exception, e: