@SuppressWarnings("unchecked")
  private boolean updateItemNode(FileItemNode itemNode, File file, MusicItem info) {
    Format format = getContentDirectory().getFormat(info.mime_type);
    if (format == null) {
      Log.d(TAG, "dms file format ==null filepath=" + info.filePath);
      return false;
    }
    FormatObject formatObj = format.createObject(file);

    // File/TimeStamp
    itemNode.setFile(file);

    // Title
    String title = info.title;
    if (title != null) itemNode.setTitle(title);

    // Creator
    String creator = formatObj.getCreator();
    if (0 < creator.length()) itemNode.setCreator(creator);

    // Media Class
    String mediaClass = format.getMediaClass();
    if (0 < mediaClass.length()) itemNode.setUPnPClass(mediaClass);

    // Date
    long lastModTime = file.lastModified();
    itemNode.setDate(lastModTime);

    // Storatge Used
    try {
      long fileSize = file.length();
      itemNode.setStorageUsed(fileSize);
    } catch (Exception e) {
      Debug.warning(e);
    }
    itemNode.setMimeType(format.getMimeType());
    itemNode.addProperty(UPnP.ALBUM, info.album);
    itemNode.addProperty(UPnP.ARITIST, info.artist);
    itemNode.addProperty(UPnP.FILEPATH, info.filePath);
    itemNode.setAlbumArtURI(getContentDirectory().getContentExportArmArtURL(info.albumArtURI));

    // ProtocolInfo
    String mimeType = format.getMimeType();
    String protocol = ConnectionManager.HTTP_GET + ":*:" + mimeType + ":*";
    String id = itemNode.getID();
    String url = getContentDirectory().getContentExportURL(id);
    info.itemUri = url;
    AttributeList objAttrList = formatObj.getAttributeList();
    objAttrList.add(new Attribute(UPnP.DURATION, info.duration));
    itemNode.setResource(url, protocol, objAttrList);

    DIDLLite didlLite = new DIDLLite();
    didlLite.setContentNode(itemNode);
    info.metaData = didlLite.toString();
    // Update SystemUpdateID
    getContentDirectory().updateSystemUpdateID();

    return true;
  }
  private boolean updateItemNode(FileItemNode itemNode, File file, PhotoItem info) {
    Format format = getContentDirectory().getFormat(file);
    if (format == null) return false;
    FormatObject formatObj = format.createObject(file);

    // File/TimeStamp
    itemNode.setFile(file);

    String title = info.title;
    if (title != null) itemNode.setTitle(title);

    // Creator
    String creator = formatObj.getCreator();
    if (0 < creator.length()) itemNode.setCreator(creator);

    // Media Class
    String mediaClass = format.getMediaClass();
    if (0 < mediaClass.length()) itemNode.setUPnPClass(mediaClass);

    // Date
    long lastModTime = file.lastModified();
    itemNode.setDate(lastModTime);

    // Storatge Used
    try {
      long fileSize = file.length();
      itemNode.setStorageUsed(fileSize);
    } catch (Exception e) {
      Debug.warning(e);
    }
    itemNode.addProperty(UPnP.FILEPATH, info.filePath);
    itemNode.setAlbumArtURI(info.thumbFilePath);

    // ProtocolInfo
    String mimeType = format.getMimeType();
    String protocol = ConnectionManager.HTTP_GET + ":*:" + mimeType + ":*";
    String id = itemNode.getID();
    String url = getContentDirectory().getContentExportURL(id);

    AttributeList objAttrList = formatObj.getAttributeList();
    itemNode.setResource(url, protocol, objAttrList);
    info.itemUri = url;

    DIDLLite didlLite = new DIDLLite();
    didlLite.setContentNode(itemNode);
    info.metaData = didlLite.toString();
    // Update SystemUpdateID
    getContentDirectory().updateSystemUpdateID();

    return true;
  }