+ # TODO: Check exception.
+ os.mkdir(self.base_path)
+
+ def find_last_folder_id(self):
+ """
+ Find last numeric folder in base_path folder.
+ The last numeric folder is the last swarm_id.
+ """
+ dir_list = []
+ pattern = re.compile("[0-9]+")
+
+ # Browse entries in base_path folder.
+ listing = os.listdir(self.base_path)
+ for entry in listing:
+ # If directory name is a number (id) add it to the list.
+ if os.path.isdir(entry):
+ if pattern.match(entry):
+ dir_list.append(int(entry))
+
+ if dir_list.empty():
+ return None
+ else:
+ dir_list.sort()
+ return dir_list[len(dir_list)-1]
+
+ def add_swarm(self, swarm):
+ f = open(os.path.join(self.base_path, "swarm.conf"))
+ pass
+
+ def add_client_session(self, session):
+ pass
+
+ def add_peer_status_message(self, msg):
+ pass
+
+ def add_status_message(self, msg):
+ pass
+
+ def add_verbose_message(self, msg):
+ pass