}
@Override
public Boolean send(DespotifyManager connectionManager) throws DespotifyException {
ChannelCallback callback = new ChannelCallback();
Channel channel = new Channel("Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1);
buffer.putShort((short)channel.getId()); // channel id
buffer.put(Hex.toBytes("00000000000000000000000000000000")); // uuid? not used
buffer.put((byte)0x00); // unknown
buffer.putInt(-1); // playlist history. -1: current. 0: changes since version 0, 1: since version 1, etc.
buffer.putInt(0); // unknown
buffer.putInt(-1); // unknown
buffer.put((byte)0x00); // 00 = get playlist ids, 01 = do not get playlist ids?
buffer.flip();
Channel.register(channel);
ManagedConnection connection = connectionManager.getManagedConnection();
connection.getProtocol().sendPacket(PacketType.getPlaylist, buffer, "request list of user playlists");
byte[] data = callback.getData("user playlists response");
connection.close();
if (data.length == 0) {
throw new DespotifyException("received an empty response!");
}