コード例 #1
0
ContentNode *MediaPlayer::getContentDirectory(Device *dev)
{
	CyberXML::Node *rootNode = browseMetaData(dev, "0", "*", 0, 0, "");
	if (rootNode == NULL)
		return NULL;

	ContentNode *contentRootNode = new RootNode();
	contentRootNode->set(rootNode);
	delete rootNode;

	getContentDirectory(contentRootNode, dev, "0");
	if (Debug::isOn() == true)
		contentRootNode->print();

	return contentRootNode;
}
コード例 #2
0
int MediaPlayer::getContentDirectory(ContentNode *parentNode, Device *dev, const char *objectID)
{
	if (objectID == NULL)
		return 0;

	CyberXML::Node *resultNode = browseDirectChildren(dev, objectID, "*", 0, 0, "");
	if (resultNode == NULL)
		return 0;

	BrowseResult browseResult(resultNode);
	//cout << browseResult.getNContentNodes() << endl;
	int nResultNode = 0;
	int nContents = browseResult.getNContentNodes();
	for (int n=0; n<nContents; n++) {
		Node *xmlNode = browseResult.getContentNode(n);
		ContentNode *contentNode = NULL;
		if (ContainerNode::isContainerNode(xmlNode) == true) {
			contentNode = new ContainerNode();
		}
		if (ItemNode::isItemNode(xmlNode) == true)
			contentNode = new BrowseResultNode();
		if (contentNode == NULL)
			continue;
		contentNode->set(xmlNode);
		parentNode->addContentNode(contentNode);
		nResultNode++;
		// Add Child Nodes
		if (contentNode->isContainerNode() == true) {
			ContainerNode *containerNode = (ContainerNode*)contentNode;
			int childCnt = containerNode->getChildCount();
			if (0 < childCnt) {
				const char *objid = containerNode->getID();
				getContentDirectory(contentNode, dev, objid);
			}
		}
	}
	delete resultNode;

	return nResultNode;
}