com.evolution.player.core.media
Interface ILibrary


public interface ILibrary

The library knows about all available medias. Roots can be added to the library. A background job scans all roots for medias. Clients can subscribe a library listener to be notified about changes in the library.

Clients must not implement.

Since:
0.6
See Also:
EvolutionPlayerCore.getLibrary()

Nested Class Summary
static class ILibrary.LibraryListener
          A library listener can listen to changed to the library.
 
Method Summary
 void addLibraryListener(ILibrary.LibraryListener listener)
          Add the given listener as a library listener.
 void addMedia(MediaInfo media)
          Adds the given media to the library.
 void addRoot(java.io.File file)
          Add the given file to the roots and index it.
 MediaInfo getMedia(MediaId id)
          Returns the media with the given id, if any.
 LocalMediaInfo[] getMedias()
          Returns all found local medias.
 java.io.File[] getRoots()
          All persisted roots.
 void indexRoot(java.io.File file)
          Index the given file as a root, but do not add it to the roots.
 boolean isEmpty()
          Returns true if the library is empty.
 void removeLibraryListener(ILibrary.LibraryListener listener)
          Remove the given listener.
 void removeRoot(java.io.File file)
          Remove the given file from the roots.
 

Method Detail

isEmpty

boolean isEmpty()
Returns true if the library is empty.

Returns:
true if the library is empty

getMedias

LocalMediaInfo[] getMedias()
Returns all found local medias.

Returns:
all local medias

getMedia

MediaInfo getMedia(MediaId id)
Returns the media with the given id, if any.

Parameters:
id - the id of the media
Returns:
the media or null

addMedia

void addMedia(MediaInfo media)
Adds the given media to the library.

Parameters:
media - the media to add

getRoots

java.io.File[] getRoots()
All persisted roots.

Returns:
all persisted roots

addRoot

void addRoot(java.io.File file)
Add the given file to the roots and index it.

This call returns immediately and the indexing happens in a background thread.

All added roots are persisted. If you want to index a folder without adding it as a root see indexRoot(File).

Parameters:
file - the file to add to root

indexRoot

void indexRoot(java.io.File file)
Index the given file as a root, but do not add it to the roots.

Parameters:
file - the file to index as a root

removeRoot

void removeRoot(java.io.File file)
Remove the given file from the roots. All medias in the root are removed from the library.

This call returns immediately and the removing happens in a background thread.

Parameters:
file - the file to remove from the roots.

addLibraryListener

void addLibraryListener(ILibrary.LibraryListener listener)
Add the given listener as a library listener.

Parameters:
listener - the listener to add

removeLibraryListener

void removeLibraryListener(ILibrary.LibraryListener listener)
Remove the given listener.

Parameters:
listener - the listener to remove