public class MetadataCache extends Object implements MetadataProvider
MetadataProvider, it should not be passed to
MetadataFinder.addMetadataProvider(MetadataProvider) because there is all kinds of special handling
needed to deal in a backwards-compatible way with older cache files that do not store media details. Instead,
use the longstanding MetadataFinder.attachMetadataCache(SlotReference, File) and
MetadataFinder.addAutoAttachCacheFile(File) methods to work with metadata cache files.| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_FORMAT_IDENTIFIER
The comment string used to identify a ZIP file as one of our metadata caches.
|
MediaDetails |
sourceMedia
Holds information about the media from which this cache was created.
|
int |
sourcePlaylist
Holds the ID of the playlist that was used to create the cache, or 0 of it is an all-tracks cache.
|
int |
trackCount
Holds the number of tracks contained in the cache.
|
| Constructor and Description |
|---|
MetadataCache(File file)
Open the specified ZIP file and prepare to serve its contents as a cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the cache.
|
static void |
createMetadataCache(SlotReference slot,
int playlistId,
File cache)
Creates a metadata cache archive file of all tracks in the specified slot on the specified player.
|
static void |
createMetadataCache(SlotReference slot,
int playlistId,
File cache,
MetadataCacheCreationListener listener)
Creates a metadata cache archive file of all tracks in the specified slot on the specified player.
|
AlbumArt |
getAlbumArt(MediaDetails sourceMedia,
DataReference art)
Get a particular album art image, if it is available.
|
BeatGrid |
getBeatGrid(MediaDetails sourceMedia,
DataReference track)
Get the beat grid for a particular track, if it is available.
|
static long |
getCachePauseInterval()
Check how long we pause between requesting metadata entries while building a cache to give the player
a chance to perform its other tasks.
|
CueList |
getCueList(MediaDetails sourceMedia,
DataReference track)
Get the cue list for a particular track, if it is available.
|
String |
getName()
Get the path name of the file containing the cache.
|
List<Integer> |
getTrackIds()
Returns a list of the rekordbox IDs of the tracks contained in the cache.
|
TrackMetadata |
getTrackMetadata(MediaDetails sourceMedia,
DataReference track)
Get metadata for a particular track, if it is available.
|
WaveformDetail |
getWaveformDetail(MediaDetails sourceMedia,
DataReference track)
Get the waveform detail for a particular track, if it is available.
|
WaveformPreview |
getWaveformPreview(MediaDetails sourceMedia,
DataReference track)
Get the waveform preview for a particular track, if it is available.
|
static void |
setCachePauseInterval(long milliseconds)
Set how long to pause between requesting metadata entries while building a cache to give the player
a chance to perform its other tasks.
|
List<MediaDetails> |
supportedMedia()
Get the list of media devices for which metadata can be offered by this provider.
|
public final int sourcePlaylist
public final int trackCount
public final MediaDetails sourceMedia
null value.public static final String CACHE_FORMAT_IDENTIFIER
public MetadataCache(File file) throws IOException
close() method to free up system resources.file - the metadata cache file to be served.IOException - if there is a problem reading the file, or if it does not have the right contentpublic void close()
throws IOException
IOException.IOException - if there is a problem closing the cachepublic String getName()
public List<Integer> getTrackIds()
public List<MediaDetails> supportedMedia()
MetadataProviderMetadataFinder.addMetadataProvider(MetadataProvider).supportedMedia in interface MetadataProviderpublic TrackMetadata getTrackMetadata(MediaDetails sourceMedia, DataReference track)
MetadataProvidergetTrackMetadata in interface MetadataProvidersourceMedia - the media to which the track belongs, for use by providers which store metadata from multiple
sourcestrack - identifies the track whose metadata is desired; since track metadata always has a player and
slot associated with it, those are needed as well as the rekordbox ID in order to create itnull if it is not a track for which we have metadatapublic AlbumArt getAlbumArt(MediaDetails sourceMedia, DataReference art)
MetadataProvidergetAlbumArt in interface MetadataProvidersourceMedia - the media to which the art belongs, for use by providers which store metadata from multiple
sourcesart - identifies the album art whose metadata is desired; since art always has a player and slot
associated with it, those are needed as well as the rekordbox ID in order to create itnull if we don't have it to offerpublic BeatGrid getBeatGrid(MediaDetails sourceMedia, DataReference track)
MetadataProvidergetBeatGrid in interface MetadataProvidersourceMedia - the media to which the track belongs, for use by providers which store metadata from multiple
sourcestrack - identifies the track whose beat grid is desired; since beat grids always have a player and
slot associated with them, those are needed as well as the rekordbox ID in order to create onenull if we don't have one to offerpublic CueList getCueList(MediaDetails sourceMedia, DataReference track)
MetadataProvidergetCueList in interface MetadataProvidersourceMedia - the media to which the track belongs, for use by providers which store metadata from multiple
sourcestrack - identifies the track whose cue list is desirednull if we don't have one to offerpublic WaveformPreview getWaveformPreview(MediaDetails sourceMedia, DataReference track)
MetadataProvidergetWaveformPreview in interface MetadataProvidersourceMedia - the media to which the track belongs, for use by providers which store metadata from multiple
sourcestrack - identifies the track whose waveform preview is desired; since beat grids always have a player and
slot associated with them, those are needed as well as the rekordbox ID in order to create onenull if we don't have one to offerpublic WaveformDetail getWaveformDetail(MediaDetails sourceMedia, DataReference track)
MetadataProvidergetWaveformDetail in interface MetadataProvidersourceMedia - the media to which the track belongs, for use by providers which store metadata from multiple
sourcestrack - identifies the track whose waveform detail is desired; since beat grids always have a player and
slot associated with them, those are needed as well as the rekordbox ID in order to create onenull if we don't have one to offerpublic static void createMetadataCache(SlotReference slot, int playlistId, File cache) throws Exception
slot - the slot in which the media to be cached can be foundplaylistId - the id of playlist to be cached, or 0 of all tracks should be cachedcache - the file into which the metadata cache should be writtenException - if there is a problem communicating with the player or writing the cache file.public static void setCachePauseInterval(long milliseconds)
milliseconds - the delay to add between each track that gets added to the metadata cachepublic static long getCachePauseInterval()
public static void createMetadataCache(SlotReference slot, int playlistId, File cache, MetadataCacheCreationListener listener) throws Exception
null listener is
supplied, its MetadataCacheCreationListener.cacheCreationContinuing(TrackMetadata, int, int) method
will be called after each track is added to the cache, allowing it to display progress updates to the user,
and to continue or cancel the process by returning true or false.
Because this takes a huge amount of time relative to CDJ status updates, it can only be performed while
the MetadataFinder is in passive mode.slot - the slot in which the media to be cached can be foundplaylistId - the id of playlist to be cached, or 0 of all tracks should be cachedcache - the file into which the metadata cache should be writtenlistener - will be informed after each track is added to the cache file being created and offered
the opportunity to cancel the processException - if there is a problem communicating with the player or writing the cache fileCopyright © 2016–2019 Deep Symmetry, LLC. All rights reserved.