def fileSync(self, data): """ Synchronization files using rsync tool """ server = [] user_db = Queries.getUser(data['user']) user_id = 'u' + str(user_db.id).rjust(14, '0') # when want to sync more than one file... for file in data['files_u']: original_name = file[0] server_name = file[1] file_hash = file[2] file_hash_new = file[3][0] file_size = file[3][1] fs = Queries.getFileServer(file_hash) if file_hash != file_hash_new and data['sync_type'] == 'WSYNC_FILE': dict_file = {"file_hash": file_hash_new, "chunk_size": file_size} Queries.updateFileRecordDataByHash(original_name, file_hash, dict_file) server.append((original_name, server_name) + (fs if fs else (None,))) data['server'] = server data['user_id'] = user_id data['cmd'] = 'CSYN' log.msg('[SYNC] SYNC data for User=%s has complete!' % (data['user'])) del data['files_u'] return data