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(); } }
private void init() { MyApplication app = (MyApplication) getApplication(); Item item = app.getItem(); app.setItem(null); imageurl = item.getFirstResource().getValue(); name = item.getTitle(); }
@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 uri = item.getFirstResource().getValue(); DIDLContent didlContent = new DIDLContent(); didlContent.addItem(item);
upnpItem.getCreator(), "", "", upnpItem.getFirstResource().getValue(), "object.item." + type);
upnpItem.getCreator(), "", "", upnpItem.getFirstResource().getValue(), "object.item." + type);
@Override public void received(ActionInvocation actionInvocation, DIDLContent didl) { LogUtil.d(TAG, "Received browse action DIDL descriptor, creating tree nodes"); try { handler.sendEmptyMessage(HandlerWhat.CLEAR_ALL); for (Container container : didl.getContainers()) { ContentItem ct = new ContentItem(container, service); sendMsg(ct); } for (Item item : didl.getItems()) { String contentFormat = item.getFirstResource().getProtocolInfo().getContentFormat(); ContentItem ct = new ContentItem(item, service, FiletypeUtil .getFiletype(contentFormat)); sendMsg(ct); } } catch (Exception e) { LogUtil.e(TAG, "Creating DIDL tree nodes failed: " + e); actionInvocation.setFailure(new ActionException( ErrorCode.ACTION_FAILED, "Can't create list childs: " + e, e)); failure(actionInvocation, null); } }