public boolean sendDelete(Protocol protocol, int position) throws DespotifyException {
ChannelCallback callback = new ChannelCallback();
/* Create channel and buffer. */
Channel channel = new Channel("Create-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
PlaylistContainer playlists = user.getPlaylists();
String xml = String.format
("<change><ops><del><i>%s</i><k>%s</k></del></ops><time>%s</time><user>%s</user></change>" +
"<version>%010d,%010d,%010d,%d</version>",
// change
position,
1, // number of playlists to delete with start at attribute "position"
new Date().getTime() / 1000,
user.getId(),
// version
playlists.getRevision() + 1,
playlists.getItems().size(),
playlists.getChecksum(),
playlist.isCollaborative() ? 1 : 0
);
byte[] xmlBytes = xml.getBytes();
ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);
buffer.putShort((short) channel.getId());
buffer.put(Hex.toBytes("00000000000000000000000000000000")); // UUID? not used
buffer.put((byte) 0x00); // type? not used
buffer.putInt((int) playlists.getRevision());
buffer.putInt(playlists.getItems().size() + 1);
buffer.putInt((int) playlists.getChecksum());