com.evolution.player.ui.artwork
Class AlbumArtworkProvider

java.lang.Object
  extended by com.evolution.player.ui.artwork.AlbumArtworkProvider

public abstract class AlbumArtworkProvider
extends java.lang.Object

An album artwork provider can provide artwork for a given media info in a long running process.

An artwork provider can be contributed through the com.evolution.player.ui.artworkProvider provided by the com.evolution.player.ui plugin.

Clients must implement.

Since:
0.5

Nested Class Summary
 class AlbumArtworkProvider.ArtworkSearchFailure
          The result of a unsuccessful album search.
 class AlbumArtworkProvider.ArtworkSearchResult
          The result of a artwork search.
 class AlbumArtworkProvider.ArtworkSearchSuccess
          The result of a successful album search.
static interface AlbumArtworkProvider.IInitializationData
          A set of data which can be used to initialize this object.
 
Constructor Summary
AlbumArtworkProvider()
           
 
Method Summary
abstract  boolean canHandle(MediaInfo info)
          True if and only if this album artwork provider can provide album artwork for the given media info.
abstract  AlbumArtworkProvider.ArtworkSearchResult findArtwork(MediaInfo info, IProgressMonitor monitor)
          Search artwork for the given media info in a long running process report progress to the given monitor and check for cancelation.
abstract  AlbumArtworkProvider.ArtworkSearchSuccess getArtwork(MediaInfo info)
          Return an artwork for the given media info in a short running process.
abstract  void initialize(AlbumArtworkProvider.IInitializationData data)
          Initialize this artwork provider with the given data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlbumArtworkProvider

public AlbumArtworkProvider()
Method Detail

initialize

public abstract void initialize(AlbumArtworkProvider.IInitializationData data)
Initialize this artwork provider with the given data. It's guaranteed that this method is called first and only once.

Parameters:
data - the data to use to initialize this object

canHandle

public abstract boolean canHandle(MediaInfo info)
True if and only if this album artwork provider can provide album artwork for the given media info. The artwork provider must be able to answer this question short running. Returning true does not mean that this artwork provider must return an artwork in any case, but it means that no other artwork provider can provide an image. Only return true if the media belongs to your domain.

This must be short running

Parameters:
info - the info to provide artwork for
Returns:
true if this artwork provider provides artwork for the given info

getArtwork

public abstract AlbumArtworkProvider.ArtworkSearchSuccess getArtwork(MediaInfo info)
Return an artwork for the given media info in a short running process. This gives the artwork provider the chance to return an artwork for the given media short running if possible, i.e. the artwork is available in a cache. Returns null if the artwork can not be returned short running. This method is only called if canHandle(MediaInfo) returns true for the same media info.

This must be short running

Parameters:
info - the info to provide artwork for
Returns:
the artwork search success if artwork can be provided or null

findArtwork

public abstract AlbumArtworkProvider.ArtworkSearchResult findArtwork(MediaInfo info,
                                                                     IProgressMonitor monitor)
Search artwork for the given media info in a long running process report progress to the given monitor and check for cancelation. If no artwork could be found return a AlbumArtworkProvider.ArtworkSearchFailure explaining why, otherwise return an AlbumArtworkProvider.ArtworkSearchSuccess containing the artwork details. This method is only called if canHandle(MediaInfo) returns true for the same media info.

This can be long running

Parameters:
info - the info to provide artwork for
monitor - the monitor to report progress to and to check for cancelation
Returns:
the search result