(cls, ts3conn, sid)
return root
Returns the channel tree from the virtual server identified with
        *sid*, using the *TS3Connection* ts3conn.
Returns the channel tree from the virtual server identified with
        *sid*, using the *TS3Connection* ts3conn.
Returns the channel tree from the virtual server identified with * sid * using the * TS3Connection * ts3conn .
def build_tree(cls, ts3conn, sid):
        """
        Returns the channel tree from the virtual server identified with
        *sid*, using the *TS3Connection* ts3conn.
        """
        ts3conn.use(sid=sid, virtual=True)

        resp = ts3conn.serverinfo()
        serverinfo = resp.parsed[0]

        resp = ts3conn.channellist()
        channellist = resp.parsed

        resp = ts3conn.clientlist()
        clientlist = resp.parsed
        # channel id -> clients
        clientlist = {cid: [client for client in clientlist \
                            if client["cid"] == cid]
                      for cid in map(lambda e: e["cid"], channellist)}

        root = cls.init_root(serverinfo)
        for channel in channellist:
            resp = ts3conn.channelinfo(cid=channel["cid"])
            channelinfo = resp.parsed[0]
            # This makes sure, that *cid* is in the dictionary.
            channelinfo.update(channel)

            channel = cls(
                info=channelinfo, parent=root, root=root,
                clients=clientlist[channel["cid"]])
            root.insert(channel)
        return root
def build_tree ( cls , ts3conn , sid ) : ts3conn . use ( sid = sid , virtual = True ) resp = ts3conn . serverinfo ( ) serverinfo = resp . parsed [ 0 ] resp = ts3conn . channellist ( ) channellist = resp . parsed resp = ts3conn . clientlist ( ) clientlist = resp . parsed # channel id -> clients clientlist = { cid : [ client for client in clientlist if client [ "cid" ] == cid ] for cid in map ( lambda e : e [ "cid" ] , channellist ) } root = cls . init_root ( serverinfo ) for channel in channellist : resp = ts3conn . channelinfo ( cid = channel [ "cid" ] ) channelinfo = resp . parsed [ 0 ] # This makes sure, that *cid* is in the dictionary. channelinfo . update ( channel ) channel = cls ( info = channelinfo , parent = root , root = root , clients = clientlist [ channel [ "cid" ] ] ) root . insert ( channel ) return root