Ejemplo n.º 1
0
    async def get_contents(self, uri, depth=0):
        contents = [Content.make(**x) for x
                    in await self.services["avContent"]["getContentList"](uri=uri)]
        contentlist = []

        for content in contents:
            if content.contentKind == 'directory' and content.index >= 0:
                # print("got directory %s" % content.uri)
                res = await self.get_contents(content.uri, depth + 4)
                contentlist.extend(res)
            else:
                contentlist.append(content)
                # print("%s%s" % (' ' * depth, content))
        return contentlist
Ejemplo n.º 2
0
    async def get_contents(self, uri) -> List[Content]:
        """Request content listing recursively for the given URI.

        :param uri: URI for the source.
        :return: List of Content objects.
        """
        contents = [
            Content.make(**x)
            for x in await self.services["avContent"]["getContentList"](uri=uri)
        ]
        contentlist = []

        for content in contents:
            if content.contentKind == "directory" and content.index >= 0:
                # print("got directory %s" % content.uri)
                res = await self.get_contents(content.uri)
                contentlist.extend(res)
            else:
                contentlist.append(content)
                # print("%s%s" % (' ' * depth, content))
        return contentlist