Package se.despotify.client.protocol.channel

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


    );

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

    Channel channel = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    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(playlist.getByteUUID());
    buffer.put((byte) 0x02); // track UUID type tag

    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(position); // uncertain
View Full Code Here


    );

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

    Channel channel = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    byte[] xmlBytes = xml.getBytes();
    ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    /* Append channel id, playlist id and some bytes... */
    buffer.putShort((short) channel.getId());
    buffer.put(playlist.getByteUUID());
    buffer.put((byte) 0x02); // track UUID type tag

    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(playlist.getTracks().size() - 1);
View Full Code Here

  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());
View Full Code Here


    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><destroy/></ops><time>%s</time><user>%s</user></change>" +
            "<version>%010d,%010d,%010d,%d</version>",
            new Date().getTime() / 1000,
            user.getId(),
            // version
            playlist.getRevision() + 1,
            playlist.getTracks().size(),
            playlist.getChecksum(),
            playlist.isCollaborative() ? 1 : 0
        );

    byte[] xmlBytes = xml.getBytes();
    ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    //  3600bd00000000 000000000000000000 000000000000 00000426 0000001a a63f [6????????????????????????&??????]
    //  d3a7 00 03 3c636861 6e67653e3c6f7073 3e3c64656c3e3c69 3e32313c2f693e3c [????<change><ops><del><i>21</i><]


    buffer.putShort((short) channel.getId());
    buffer.put(playlist.getByteUUID());
    buffer.put((byte) 0x02); // playlist type UUID tag
    buffer.putInt((int) playlist.getRevision().longValue());
    buffer.putInt(playlist.getTracks().size());
    buffer.putInt((int) playlists.getChecksum());
View Full Code Here

    );

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

    Channel channel = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    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(playlist.getByteUUID());
    buffer.put((byte) 0x02); // track UUID type tag

    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(position); // uncertain
View Full Code Here

    );

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

    Channel channel = new Channel("Change-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    byte[] xmlBytes = xml.getBytes();
    ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    /* Append channel id, playlist id and some bytes... */
    buffer.putShort((short) channel.getId());
    buffer.put(playlist.getByteUUID());
    buffer.put((byte) 0x02); // track UUID type tag

    buffer.putInt(playlist.getRevision().intValue());
    buffer.putInt(playlist.getTracks().size() - 1);
View Full Code Here

  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());
View Full Code Here


    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><destroy/></ops><time>%s</time><user>%s</user></change>" +
            "<version>%010d,%010d,%010d,%d</version>",
            new Date().getTime() / 1000,
            user.getId(),
            // version
            playlist.getRevision() + 1,
            playlist.getTracks().size(),
            playlist.getChecksum(),
            playlist.isCollaborative() ? 1 : 0
        );

    byte[] xmlBytes = xml.getBytes();
    ByteBuffer buffer = ByteBuffer.allocate(2 + 16 + 1 + 4 + 4 + 4 + 1 + 1 + xmlBytes.length);

    //  3600bd00000000 000000000000000000 000000000000 00000426 0000001a a63f [6????????????????????????&??????]
    //  d3a7 00 03 3c636861 6e67653e3c6f7073 3e3c64656c3e3c69 3e32313c2f693e3c [????<change><ops><del><i>21</i><]


    buffer.putShort((short) channel.getId());
    buffer.put(playlist.getByteUUID());
    buffer.put((byte) 0x02); // playlist type UUID tag
    buffer.putInt((int) playlist.getRevision().longValue());
    buffer.putInt(playlist.getTracks().size());
    buffer.putInt((int) playlists.getChecksum());
View Full Code Here

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


    /* Create channel and buffer. */
    Channel channel = new Channel("Create-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    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(requestedPlaylistUUID);
    buffer.put((byte) 0x02); // uuid playlist marker?
    buffer.putInt(0); // playlist revision?
    buffer.putInt(0); // playlist tracks size?
    buffer.putInt(-1); // playlist checksum? -1 when create uuid
View Full Code Here

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


    /* Create channel and buffer. */
    Channel channel = new Channel("Create-Playlist-Channel", Channel.Type.TYPE_PLAYLIST, callback);
    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(requestedPlaylistUUID);
    buffer.put((byte) 0x02); // uuid playlist marker?
    buffer.putInt(0); // playlist revision?
    buffer.putInt(0); // playlist tracks size?
    buffer.putInt(-1); // playlist checksum? -1 when create uuid
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.