Package se.despotify.client.protocol.channel

Examples of se.despotify.client.protocol.channel.Channel


    ChannelCallback callback = new ChannelCallback();

    /* Send browse request. */

    /* Create channel and buffer. */
    Channel channel = new Channel("Browse-Channel", Channel.Type.TYPE_BROWSE, callback);
    ByteBuffer buffer = ByteBuffer.allocate(2 + 1 + 16 + 4);


    buffer.putShort((short) channel.getId());
    buffer.put((byte) BrowseType.album.getValue());
    buffer.put(album.getByteUUID());
    buffer.putInt(0); // unknown


View Full Code Here


  }

  /* Request ads. The response is GZIP compressed XML. */
  public void sendAdRequest(ChannelListener listener, int type) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("Ad-Channel", Channel.Type.TYPE_AD, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 1);

    /* Append channel id and ad type. */
    buffer.putShort((short)channel.getId());
    buffer.put((byte)type);
    buffer.flip();

    /* Register channel. */
    Channel.register(channel);
 
View Full Code Here

  }

  /* Request image using a 20 byte id. The response is a JPG. */
  public void sendImageRequest(ChannelListener listener, String id) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("Image-Channel", Channel.Type.TYPE_IMAGE, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 20);

    /* Append channel id and image hash. */
    buffer.putShort((short)channel.getId());
    buffer.put(Hex.toBytes(id));
    buffer.flip();

    /* Register channel. */
    Channel.register(channel);
 
View Full Code Here

  }

  /* Request AES key for a track. */
  public void sendAesKeyRequest(ChannelListener listener, Track track) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("AES-Key-Channel", Channel.Type.TYPE_AESKEY, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(20 + 16 + 2 + 2);

    /* Request the AES key for this file by sending the file id and track id. */
    buffer.put(Hex.toBytes(track.getFiles().get(0).getId())); /* 20 bytes */
    buffer.put(track.getByteUUID()); /* 16 bytes */
    buffer.putShort((short)0x0000);
    buffer.putShort((short)channel.getId());
    buffer.flip();

    /* Register channel. */
    Channel.register(channel);

 
View Full Code Here

   * with AES key provided and a static IV, incremented for
   * each 16 byte data processed.
   */
  public void sendSubstreamRequest(ChannelListener listener, Track track, int offset, int length) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("Substream-Channel", Channel.Type.TYPE_SUBSTREAM, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 2 + 2 + 2 + 2 + 2 + 4 + 20 + 4 + 4);

    /* Append channel id. */
    buffer.putShort((short)channel.getId());

    /* Unknown 10 bytes. */
    buffer.putShort((short)0x0800);
    buffer.putShort((short)0x0000);
    buffer.putShort((short)0x0000);
 
View Full Code Here


  /* Change playlist. The response comes as plain XML. */
  public void sendChangePlaylist(ChannelListener listener, Playlist playlist, String xml, String packetDescription) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel  = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, listener);
    byte[]     xmlBytes = xml.getBytes();
    ByteBuffer buffer   = ByteBuffer.allocate(2 + 17 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    /* Append channel id, playlist id and some bytes... */
    buffer.putShort((short)channel.getId());
    buffer.put(playlist.getByteUUID()); /* 16 bytes */
    buffer.put((byte)0x00); // 0x00 for adding tracks, 0x02 for the rest?
    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(playlist.getTracks().size());
    buffer.putInt(playlist.getChecksum().intValue()); /* -1: Create playlist. */
 
View Full Code Here

      /* Create channel callback */
      ChannelCallback callback = new ChannelCallback();

    /* Create channel and buffer. */
    Channel channel = new Channel("Image-Channel", Channel.Type.TYPE_IMAGE, callback);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 20);

    /* Append channel id and image hash. */
    buffer.putShort((short)channel.getId());
    buffer.put(image.getByteUUID());
    buffer.flip();

    /* Register channel. */
    Channel.register(channel);
View Full Code Here

   * with AES key provided and a static IV, incremented for
   * each 16 byte data processed.
   */
  public void sendSubstreamRequest(ChannelListener listener, Track track, int offset, int length) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("Substream-Channel", Channel.Type.TYPE_SUBSTREAM, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 2 + 2 + 2 + 2 + 2 + 4 + 20 + 4 + 4);

    /* Append channel id. */
    buffer.putShort((short)channel.getId());

    /* Unknown 10 bytes. */
    buffer.putShort((short)0x0800);
    buffer.putShort((short)0x0000);
    buffer.putShort((short)0x0000);
 
View Full Code Here


  /* Change playlist. The response comes as plain XML. */
  public void sendChangePlaylist(ChannelListener listener, Playlist playlist, String xml, String packetDescription) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel  = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, listener);
    byte[]     xmlBytes = xml.getBytes();
    ByteBuffer buffer   = ByteBuffer.allocate(2 + 17 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    /* Append channel id, playlist id and some bytes... */
    buffer.putShort((short)channel.getId());
    buffer.put(playlist.getByteUUID()); /* 16 bytes */
    buffer.put((byte)0x00); // 0x00 for adding tracks, 0x02 for the rest?
    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(playlist.getTracks().size());
    buffer.putInt(playlist.getChecksum().intValue()); /* -1: Create playlist. */
 
View Full Code Here

  }

  /* Request ads. The response is GZIP compressed XML. */
  public void sendAdRequest(ChannelListener listener, int type) throws DespotifyException {
    /* Create channel and buffer. */
    Channel    channel = new Channel("Ad-Channel", Channel.Type.TYPE_AD, listener);
    ByteBuffer buffer  = ByteBuffer.allocate(2 + 1);

    /* Append channel id and ad type. */
    buffer.putShort((short)channel.getId());
    buffer.put((byte)type);
    buffer.flip();

    /* Register channel. */
    Channel.register(channel);
 
View Full Code Here

TOP

Related Classes of se.despotify.client.protocol.channel.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.