Class MediaDetails


  • public class MediaDetails
    extends Object
    Represents information about the media mounted in a player's slot; returned in response to a media query packet.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Color color
      The color tint that should be applied to the user interface when a player mounts this media.
      String creationDate
      The creation date of the media.
      long freeSpace
      The amount of storage remaining, in bytes.
      boolean hasMySettings
      Indicates that the DJ has stored device setting preferences on the media, so the player should display an alert showing how to apply them when at the root menu.
      CdjStatus.TrackType mediaType
      The type of tracks stored in this media.
      static int MINIMUM_PACKET_SIZE
      The smallest packet size from which we can be constructed.
      String name
      The name assigned to the media within rekordbox.
      int playlistCount
      The number of rekordbox playlists in the media database.
      SlotReference slotReference
      The player and slot in which this media resides.
      long totalSize
      The size of the storage space, in bytes.
      int trackCount
      The number of rekordbox tracks in the media database.
    • Constructor Summary

      Constructors 
      Constructor Description
      MediaDetails​(byte[] packet, int packetLength)
      Constructor sets all the immutable interpreted fields based on the packet content.
    • Field Detail

      • slotReference

        public final SlotReference slotReference
        The player and slot in which this media resides.
      • mediaType

        public final CdjStatus.TrackType mediaType
        The type of tracks stored in this media.
      • name

        public final String name
        The name assigned to the media within rekordbox.
      • creationDate

        public final String creationDate
        The creation date of the media.
      • trackCount

        public final int trackCount
        The number of rekordbox tracks in the media database. Will be zero if mediaType is not rekordbox.
      • playlistCount

        public final int playlistCount
        The number of rekordbox playlists in the media database. Will be zero if mediaType is not rekordbox.
      • color

        public final Color color
        The color tint that should be applied to the user interface when a player mounts this media.
      • hasMySettings

        public final boolean hasMySettings
        Indicates that the DJ has stored device setting preferences on the media, so the player should display an alert showing how to apply them when at the root menu.
      • totalSize

        public final long totalSize
        The size of the storage space, in bytes.
      • freeSpace

        public final long freeSpace
        The amount of storage remaining, in bytes.
      • MINIMUM_PACKET_SIZE

        public static final int MINIMUM_PACKET_SIZE
        The smallest packet size from which we can be constructed. Anything less than this and we are missing crucial information.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MediaDetails

        public MediaDetails​(byte[] packet,
                            int packetLength)
        Constructor sets all the immutable interpreted fields based on the packet content.
        Parameters:
        packet - the media response packet that was received or cached
        packetLength - the number of bytes within the packet which were actually received
    • Method Detail

      • getRawBytes

        public ByteBuffer getRawBytes()
        Get the raw bytes of the media details as returned by the player.
        Returns:
        the bytes that make up the media details
      • hashKey

        public String hashKey()
        Build a string containing the things that we do not expect to change about the media, to help us recognize it when it gets mounted in the future.
        Returns:
        a colon-delimited string made up of the creation date, media type, total size, and name
      • hasChanged

        public boolean hasChanged​(MediaDetails originalMedia)
        Check whether the media seems to have changed since a saved version of it was used. We ignore changes in free space because those probably just reflect history entries being added.
        Parameters:
        originalMedia - the media details when information about it was saved
        Returns:
        true if there have been detectable significant changes to the media since it was saved
        Throws:
        IllegalArgumentException - if the hashKey() values of the media detail objects differ