Class MediaDetails


  • @API(status=STABLE)
    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 Detail

      • slotReference

        @API(status=STABLE)
        public final SlotReference slotReference
        The player and slot in which this media resides.
      • mediaType

        @API(status=STABLE)
        public final CdjStatus.TrackType mediaType
        The type of tracks stored in this media.
      • name

        @API(status=STABLE)
        public final String name
        The name assigned to the media within rekordbox.
      • creationDate

        @API(status=STABLE)
        public final String creationDate
        The creation date of the media.
      • trackCount

        @API(status=STABLE)
        public final int trackCount
        The number of rekordbox tracks in the media database. Will be zero if mediaType is not rekordbox.
      • playlistCount

        @API(status=STABLE)
        public final int playlistCount
        The number of rekordbox playlists in the media database. Will be zero if mediaType is not rekordbox.
      • color

        @API(status=STABLE)
        public final Color color
        The color tint that should be applied to the user interface when a player mounts this media.
      • hasMySettings

        @API(status=STABLE)
        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

        @API(status=STABLE)
        public final long totalSize
        The size of the storage space, in bytes.
      • freeSpace

        @API(status=STABLE)
        public final long freeSpace
        The amount of storage remaining, in bytes.
      • MINIMUM_PACKET_SIZE

        @API(status=STABLE)
        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

        @API(status=STABLE)
        public MediaDetails​(SlotReference slotReference,
                            CdjStatus.TrackType mediaType,
                            String name,
                            int trackCount,
                            int playlistCount,
                            long lastModified)
        Constructor to emulate an actual MediaDetails object from CDJs. This allows our status packets to use OpusProvider to enrich the track data. OpusProvider must be started to use this method.
        Parameters:
        slotReference - Slot Reference to which these media details belong
        mediaType - Media Type to Emulate
        name - Name of the emulated media volume
        trackCount - How many tracks are present in the media
        playlistCount - How many playlists are present in the media
        lastModified - When the media was last changed
      • MediaDetails

        @API(status=STABLE)
        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

        @API(status=STABLE)
        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

        @API(status=STABLE)
        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

        @API(status=STABLE)
        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