public void addContentNode(ContentNode node) { addNode(node); node.setParentID(getID()); node.setContentDirectory(getContentDirectory()); }
public int compare(ContentNode conNode1, ContentNode conNode2) { if (conNode1 == null || conNode2 == null) return 0; if (!(conNode1 instanceof ItemNode) || !(conNode2 instanceof ItemNode)) return 0; ItemNode itemNode1 = (ItemNode)conNode1; ItemNode itemNode2 = (ItemNode)conNode2; long itemTime1 = itemNode1.getDateTime(); long itemTime2 = itemNode2.getDateTime(); if (itemTime1 == itemTime2) return 0; return (itemTime1 < itemTime2) ? -1 : 1; } }
public ItemNode findItem(){ int inputID; boolean found = false; ItemNode current = null; try{ System.out.print("\nGreetings, please enter the ID number for item:\n"); inputID = scannerObject.nextInt(); scannerObject.nextLine(); for (current = head; !found; current = current.getNext()){ if (current.getID() == inputID){ return current; // return the result when you find the node } } }catch(Exception e) { System.out.println("\nERROR!"); } return current; }
public static MediaItem create(ItemNode node){ MediaItem item = new MediaItem(); item.setStringid(node.getID()); item.setTitle(node.getTitle()); item.setObjectClass(node.getUPnPClass()); item.setDate(node.getDateTime()); item.setAlbum(node.getAlbum()); item.setAlbumUri(node.getAlbumArtURI()); item.setArtist(node.getArtist()); ResourceNode resourceNode = node.getFirstResource(); if (resourceNode != null){ item.setRes(resourceNode.getURL()); item.setprotocolInfo(resourceNode.getProtocolInfo()); item.setDuration(DlnaUtil.formatDurationString(resourceNode.getDuration())); item.setSize(DlnaUtil.formatSizeString(resourceNode.getSize())); } return item; } }
public boolean set(Node node) { // Child Node -> Property; int nNode = node.getNNodes(); for (int n=0; n<nNode; n++) { Node cnode = node.getNode(n); if (ContainerNode.isContainerNode(cnode) == true) continue; if (ItemNode.isItemNode(cnode) == true) continue; if (ResourceNode.isResourceNode(cnode) == true) { ResourceNode resNode = new ResourceNode(); resNode.set(cnode); addResourceNode(resNode); continue; } setProperty(cnode.getName(), cnode.getValue()); } // Attribute -> Attribute; int nAttr = node.getNAttributes(); for (int n=0; n<nAttr; n++) { Attribute attr = node.getAttribute(n); setAttribute(attr.getName(), attr.getValue()); } return true; }
contentNode = new ContainerNode(); else if (ItemNode.isItemNode(xmlNode) == true) contentNode = new ItemNode(); if (contentNode == null) continue;
long contentLen = itemNode.getContentLength(); String contentType = itemNode.getMimeType(); InputStream contentIn = itemNode.getContentInputStream();
ItemNode root = ...; public ItemNode findNode(int value){ if(root !=null){ ItemNode temp = root; while(temp!=null){ if(temp.getID() == value) return temp; temp = temp.next; } } return null; }
public boolean set(Node node) { // Child Node -> Property; int nNode = node.getNNodes(); for (int n=0; n<nNode; n++) { Node cnode = node.getNode(n); if (ContainerNode.isContainerNode(cnode) == true) continue; if (ItemNode.isItemNode(cnode) == true) continue; setProperty(cnode.getName(), cnode.getValue()); } // Attribute -> Attribute; int nAttr = node.getNAttributes(); for (int n=0; n<nAttr; n++) { Attribute attr = node.getAttribute(n); setAttribute(attr.getName(), attr.getValue()); } return true; }
public boolean setAVTransportURI( Device dev, ItemNode itemNode) { if (dev == null) return false; ResourceNode resNode = itemNode.getFirstResource(); if (resNode == null) return false; String resURL = resNode.getURL(); if (resURL == null || resURL.length() <= 0) return false; Service avTransService = dev.getService(AVTransport.SERVICE_TYPE); if (avTransService == null) return false; Action action = avTransService.getAction(AVTransport.SETAVTRANSPORTURI); if (action == null) return false; action.setArgumentValue(AVTransport.INSTANCEID, "0"); action.setArgumentValue(AVTransport.CURRENTURI, resURL); action.setArgumentValue(AVTransport.CURRENTURIMETADATA, ""); return action.postControlAction(); }
public boolean set(Node node) { // Child Node -> Property; int nNode = node.getNNodes(); for (int n=0; n<nNode; n++) { Node cnode = node.getNode(n); if (ContainerNode.isContainerNode(cnode) == true) continue; if (ItemNode.isItemNode(cnode) == true) continue; if (ResourceNode.isResourceNode(cnode) == true) { ResourceNode resNode = new ResourceNode(); resNode.set(cnode); addResourceNode(resNode); continue; } setProperty(cnode.getName(), cnode.getValue()); } // Attribute -> Attribute; int nAttr = node.getNAttributes(); for (int n=0; n<nAttr; n++) { Attribute attr = node.getAttribute(n); setAttribute(attr.getName(), attr.getValue()); } return true; }
contentNode = new ContainerNode(); else if (ItemNode.isItemNode(xmlNode) == true) contentNode = new ItemNode(); if (contentNode == null) continue;
long contentLen = itemNode.getContentLength(); String contentType = itemNode.getMimeType(); InputStream contentIn = itemNode.getContentInputStream();
public boolean set(Node node) { // Child Node -> Property; int nNode = node.getNNodes(); for (int n=0; n<nNode; n++) { Node cnode = node.getNode(n); if (ContainerNode.isContainerNode(cnode) == true) continue; if (ItemNode.isItemNode(cnode) == true) continue; setProperty(cnode.getName(), cnode.getValue()); } // Attribute -> Attribute; int nAttr = node.getNAttributes(); for (int n=0; n<nAttr; n++) { Attribute attr = node.getAttribute(n); setAttribute(attr.getName(), attr.getValue()); } return true; }
public boolean setAVTransportURI( Device dev, ItemNode itemNode) { if (dev == null) return false; ResourceNode resNode = itemNode.getFirstResource(); if (resNode == null) return false; String resURL = resNode.getURL(); if (resURL == null || resURL.length() <= 0) return false; Service avTransService = dev.getService(AVTransport.SERVICE_TYPE); if (avTransService == null) return false; Action action = avTransService.getAction(AVTransport.SETAVTRANSPORTURI); if (action == null) return false; action.setArgumentValue(AVTransport.INSTANCEID, "0"); action.setArgumentValue(AVTransport.CURRENTURI, resURL); action.setArgumentValue(AVTransport.CURRENTURIMETADATA, ""); return action.postControlAction(); }
public void addContentNode(ContentNode node) { addNode(node); node.setParentID(getID()); node.setContentDirectory(getContentDirectory()); }
contentNode = new ContainerNode(); else if (ItemNode.isItemNode(xmlNode) == true) contentNode = new ItemNode(); if (contentNode == null) continue;
public int compare(ContentNode conNode1, ContentNode conNode2) { if (conNode1 == null || conNode2 == null) return 0; if (!(conNode1 instanceof ItemNode) || !(conNode2 instanceof ItemNode)) return 0; ItemNode itemNode1 = (ItemNode)conNode1; ItemNode itemNode2 = (ItemNode)conNode2; long itemTime1 = itemNode1.getDateTime(); long itemTime2 = itemNode2.getDateTime(); if (itemTime1 == itemTime2) return 0; return (itemTime1 < itemTime2) ? -1 : 1; } }