- java.lang.Object
-
- org.deepsymmetry.beatlink.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 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.MediaDetails(SlotReference slotReference, CdjStatus.TrackType mediaType, String name, int trackCount, int playlistCount, long lastModified)
Constructor to emulate an actual MediaDetails object from CDJs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuffer
getRawBytes()
Get the raw bytes of the media details as returned by the player.boolean
hasChanged(MediaDetails originalMedia)
Check whether the media seems to have changed since a saved version of it was used.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.String
toString()
-
-
-
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 ifmediaType
is not rekordbox.
-
playlistCount
@API(status=STABLE) public final int playlistCount
The number of rekordbox playlists in the media database. Will be zero ifmediaType
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 useOpusProvider
to enrich the track data.OpusProvider
must be started to use this method.- Parameters:
slotReference
- Slot Reference to which these media details belongmediaType
- Media Type to Emulatename
- Name of the emulated media volumetrackCount
- How many tracks are present in the mediaplaylistCount
- How many playlists are present in the medialastModified
- 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 cachedpacketLength
- 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 thehashKey()
values of the media detail objects differ
-
-