if (item.getClazz() == null) { throw new RuntimeException("Missing 'upnp:class' element for item: " + item.getId()); if (item.getId() == null) throw new NullPointerException("Missing id on item: " + item); itemElement.setAttribute("id", item.getId()); if (item.getParentID() == null) throw new NullPointerException("Missing parent id on item: " + item); itemElement.setAttribute("parentID", item.getParentID()); if (item.getRefID() != null) itemElement.setAttribute("refID", item.getRefID()); itemElement.setAttribute("restricted", booleanToInt(item.isRestricted())); String title = item.getTitle(); if (title == null) { log.warning("Missing 'dc:title' element for item: " + item.getId()); title = UNKNOWN_TITLE; itemElement, "dc:creator", item.getCreator(), DIDLObject.Property.DC.NAMESPACE.URI ); itemElement, "upnp:writeStatus", item.getWriteStatus(),
protected Item createItem(Attributes attributes) { Item item = new Item(); item.setId(attributes.getValue("id")); item.setParentID(attributes.getValue("parentID")); try { Boolean value = (Boolean)Datatype.Builtin.BOOLEAN.getDatatype().valueOf( attributes.getValue("restricted") ); if (value != null) item.setRestricted(value); } catch (Exception ex) { // Ignore } if ((attributes.getValue("refID") != null)) item.setRefID(attributes.getValue("refID")); return item; }
@Override protected boolean isLastElement(String uri, String localName, String qName) { if (DIDLContent.NAMESPACE_URI.equals(uri) && "item".equals(localName)) { if (getInstance().getTitle() == null) { log.warning("In DIDL content, missing 'dc:title' element for item: " + getInstance().getId()); } if (getInstance().getClazz() == null) { log.warning("In DIDL content, missing 'upnp:class' element for item: " + getInstance().getId()); } return true; } return false; } }
form.addLabelAndSelectableLastField("Title:", item.getTitle(), this); if (item.getCreator() != null) { form.addLabelAndSelectableLastField("DC Creator:", item.getCreator(), this); if (item.getWriteStatus() != null) { form.addLabelAndSelectableLastField("UPnP Write Status:", item.getWriteStatus().toString(), this); form.addLabelAndSelectableLastField("UPnP Class:", item.getClazz().getValue(), this); form.addLabelAndSelectableLastField("ID:", item.getId(), this); form.addLabelAndSelectableLastField("Parent ID:", item.getParentID(), this); if (item.getRefID() != null) { form.addLabelAndSelectableLastField("Reference ID:", item.getRefID(), this); if (item.hasProperty(DIDLObject.Property.DC.CONTRIBUTOR.class)) form.addLabelAndSelectableLastField("DC Contributor:", item.getFirstProperty(DIDLObject.Property.DC.CONTRIBUTOR.class).toString(), this); if (item.hasProperty(DIDLObject.Property.DC.DATE.class)) form.addLabelAndSelectableLastField("DC Date:", item.getFirstProperty(DIDLObject.Property.DC.DATE.class).toString(), this); if (item.hasProperty(DIDLObject.Property.DC.DESCRIPTION.class)) form.addLabelAndSelectableLastField("DC Description:", item.getFirstProperty(DIDLObject.Property.DC.DESCRIPTION.class).toString(), this); if (item.hasProperty(DIDLObject.Property.DC.LANGUAGE.class)) form.addLabelAndSelectableLastField("DC Language:", item.getFirstProperty(DIDLObject.Property.DC.LANGUAGE.class).toString(), this); if (item.hasProperty(DIDLObject.Property.DC.PUBLISHER.class)) form.addLabelAndSelectableLastField("DC Publisher:", item.getFirstProperty(DIDLObject.Property.DC.PUBLISHER.class).toString(), this);
final TrackMetadata trackMetadata = new TrackMetadata(upnpItem.getId(), upnpItem.getTitle(), upnpItem.getCreator(), "", "", upnpItem.getFirstResource().getValue(), "object.item." + type);
public ContentItem(Service service, Item item) { this.service = service; didlObject = item; id = item.getId(); title = item.getTitle(); isContainer = false; try { format = item.getFirstResource().getProtocolInfo().getContentFormat(); } catch (Exception e) { e.printStackTrace(); } try { url = item.getFirstResource().getValue(); } catch (Exception e) { e.printStackTrace(); } }
public static boolean isAudioItem(Item item) { // TODO zxt need check? String objectClass = item.getId(); if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_MUSICID)) { return true; } return false; }
public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (node.getUserObject() instanceof Container) { Container container = (Container) node.getUserObject(); setText(container.getTitle()); setIcon(expanded ? getContainerOpenIcon() : getContainerClosedIcon()); } else if (node.getUserObject() instanceof Item) { Item item = (Item) node.getUserObject(); setText(item.getTitle()); DIDLObject.Class upnpClass = item.getClazz(); setIcon(getItemIcon(item, upnpClass != null ? upnpClass.getValue() : null)); } else if (node.getUserObject() instanceof String) { setIcon(getInfoIcon()); } onCreate(); return this; }
private void init() { MyApplication app = (MyApplication) getApplication(); Item item = app.getItem(); app.setItem(null); imageurl = item.getFirstResource().getValue(); name = item.getTitle(); }
private ArrayList<DIDLObjectDisplay> buildContentList(String parent, DIDLContent didl) { ArrayList<DIDLObjectDisplay> list = new ArrayList<DIDLObjectDisplay>(); if (parent != null) list.add(new DIDLObjectDisplay(new ClingDIDLParentContainer(parent))); for (Container item : didl.getContainers()) { list.add(new DIDLObjectDisplay(new ClingDIDLContainer(item))); Log.v(TAG, "Add container : " + item.getTitle()); } for (Item item : didl.getItems()) { ClingDIDLItem clingItem = null; if(item instanceof VideoItem) clingItem = new ClingVideoItem((VideoItem)item); else if(item instanceof AudioItem) clingItem = new ClingAudioItem((AudioItem)item); else if(item instanceof ImageItem) clingItem = new ClingImageItem((ImageItem)item); else clingItem = new ClingDIDLItem(item); list.add(new DIDLObjectDisplay(clingItem)); Log.v(TAG, "Add item : " + item.getTitle()); for (DIDLObject.Property p : item.getProperties()) Log.v(TAG, p.getDescriptorName() + " " + p.toString()); } return list; }
@Override public Response serve(IHTTPSession session) { String itemId = session.getUri().replaceFirst("/", ""); itemId = URLDecoder.decode(itemId); if (itemId != null && ContentTree.hasNode(itemId)) { ContentNode node = ContentTree.getNode(itemId); if (node.isItem()) { String localPath = node.getFullPath(); Long fileSize = node.getItem().getFirstResource().getSize(); String mimeType = node.getItem().getFirstResource() .getProtocolInfo().getContentFormatMimeType().toString(); return responseFile(mimeType, localPath, fileSize); } } Log.d(TAG, " response error!"); String msg = "<html><body><h1>Error</h1>\n" + "</body></html>\n"; return newFixedLengthResponse(msg); }
String genericType = genericItem.getClazz().getValue();
public MItem(Item other) { super(other); setRefID(other.getRefID()); }
url = didl.getItems().get(0).getResources().get(0).getValue();
@Override @Nonnull public final DIDLObject toObject() throws Exception { log.debug("toObject() - {}", datum); final DIDLObject item = datum.getDelegate().as(DIDLAdapter).toObject(); if (item instanceof Item) { ((Item)item).setRefID(item.getId()); // don't externalize this } item.setId(externalized(datum.getPath().toString())); datum.getParent().ifPresent(parent -> item.setParentID(externalized(parent.getPath().toString()))); return item; } }
final TrackMetadata trackMetadata = new TrackMetadata(upnpItem.getId(), upnpItem.getTitle(), upnpItem.getCreator(), "", "", upnpItem.getFirstResource().getValue(), "object.item." + type);
@Override protected boolean isLastElement(String uri, String localName, String qName) { if (DIDLContent.NAMESPACE_URI.equals(uri) && "item".equals(localName)) { if (getInstance().getTitle() == null) { log.warning("In DIDL content, missing 'dc:title' element for item: " + getInstance().getId()); } if (getInstance().getClazz() == null) { log.warning("In DIDL content, missing 'upnp:class' element for item: " + getInstance().getId()); } return true; } return false; } }
public static boolean isPictureItem(Item item) { // TODO zxt need check? String objectClass = item.getId(); if (objectClass != null && objectClass.contains(DLNA_OBJECTCLASS_PHOTOID)) { return true; } return false; }