+ """
+ Create a subfolder with an unique id. Add 1 to the last numeric
+ subfolder id. In case none exists, use 1 as id.
+ """
+ id = find_last_numeric_subfolder(self.base_path)
+ if id == None:
+ id = 1
+ else:
+ id = id+1
+
+ swarm_path = os.path.join(self.base_path, str(id))
+ os.mkdir(swarm_path)
+
+ swarm_config = os.path.join(swarm_path, "swarm.conf")
+ f = open(swarm_config, 'w')
+ f.write("""id = %s
+ self.torrent_filename = %s
+ self.data_size = %s
+ self.description = %s
+ """ %(id, swarm.torrent_filename, swarm.data_size, swarm.description))
+ f.close()