def configure(self, url, pwd, name, response): ''' Configure cozy-files url {string}: cozy url pwd {string}: cozy password name {string}: device name response {object}: response of responseuest to add device in cozy ''' self.max_prog = 0.1 self._display_error("") init_database() self.max_prog = 0.15 data = json.loads(response.content) replicate_to_local_one_shot_without_deleted( url, name, data['password'], data['id']) self.max_prog = 0.40 err = init_device(url, data['password'], data['id']) if err: self._display_error(err) return replicate_from_local_one_shot(url, name, data['password'], data['id']) self.max_prog = 0.70 self.max_prog = 0.72 pass
def startSync(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_one_shot( url, name, pwd, idDevice) replication.replicate_from_local_one_shot( url, name, pwd, idDevice)