public String getDlnaOrgFlags() { return getAdditionalInfoForKey("DLNA.ORG_FLAGS"); }
public String getDuration() { return getAttributeValue("duration"); } // add by geniusgitub end
public boolean isThumbnail() { String dlnaOrgPn = getDlnaOrgPn(); if (dlnaOrgPn == null) return false; if (dlnaOrgPn.endsWith("_TN")) return true; return false; }
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; }
public String getNetwork() { return getProtocolInfoAtIndex(1); }
public boolean isImage() { String mimeType = getContentFormat(); if (mimeType == null) return false; return mimeType.startsWith("image"); }
public String getProtocolInfoAtIndex(int anIndex) { String protocolInfo = getProtocolInfo(); if (protocolInfo == null) return ""; String protocols[] = protocolInfo.split(":"); if (protocols == null || protocols.length <= anIndex) return ""; return protocols[anIndex]; }
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 String getURL() { return getValue(); }
public String getAdditionalInfoForKey(String aKey) { if (aKey == null) return ""; String fullAddInfo = getAdditionalInfo(); if (fullAddInfo == null) return ""; String addInfos[] = fullAddInfo.split(";"); if (addInfos == null || addInfos.length <= 0) return ""; for (int n=0; n<addInfos.length; n++) { String addInfo = addInfos[n]; if (addInfo.startsWith(aKey) == false) continue; String tokens[] = addInfo.split("="); if (tokens == null || tokens.length < 2) return ""; return tokens[1]; } return ""; }
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; }
public String getContentFormat() { return getProtocolInfoAtIndex(2); }
public boolean isAudio() { String mimeType = getContentFormat(); if (mimeType == null) return false; return mimeType.startsWith("audio"); } }
public String getProtocolInfoAtIndex(int anIndex) { String protocolInfo = getProtocolInfo(); if (protocolInfo == null) return ""; String protocols[] = protocolInfo.split(":"); if (protocols == null || protocols.length <= anIndex) return ""; return protocols[anIndex]; }
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 String getURL() { return getValue(); }
public String getAdditionalInfoForKey(String aKey) { if (aKey == null) return ""; String fullAddInfo = getAdditionalInfo(); if (fullAddInfo == null) return ""; String addInfos[] = fullAddInfo.split(";"); if (addInfos == null || addInfos.length <= 0) return ""; for (int n=0; n<addInfos.length; n++) { String addInfo = addInfos[n]; if (addInfo.startsWith(aKey) == false) continue; String tokens[] = addInfo.split("="); if (tokens == null || tokens.length < 2) return ""; return tokens[1]; } return ""; }
public boolean isLargeImage() { String dlnaOrgPn = getDlnaOrgPn(); if (dlnaOrgPn == null) return false; if (dlnaOrgPn.endsWith("_LRG")) return true; return false; }
public String getAdditionalInfo() { return getProtocolInfoAtIndex(3); }