sk.baka.ambient.library
Class Library

java.lang.Object
  extended by sk.baka.ambient.library.Library

public final class Library
extends java.lang.Object

The music library. Emits ILibraryListener messages on events.

Author:
Martin Vysny

Field Summary
(package private)  DBStrategy backend
          The database back-end.
 
Constructor Summary
Library(android.content.Context ctx)
          Creates new library.
 
Method Summary
 void close()
          Closes this instance of the library.
protected  void finalize()
           
 DBStrategy getBackend()
          Returns database backend object.
 int getGenreCount()
          Returns overall genre count.
 Statistics getStatistics(TrackOriginEnum origin)
          Returns statistics for storage for given origin.
 void queueScanner(TrackOriginEnum storage)
          Rescans desired storage for music files and adds them to the library.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backend

final DBStrategy backend
The database back-end.

Constructor Detail

Library

public Library(android.content.Context ctx)
        throws java.io.FileNotFoundException
Creates new library. There should be at most one library instance.

Parameters:
ctx - the context.
Throws:
java.io.FileNotFoundException - if database fails to initialize
Method Detail

queueScanner

public void queueScanner(TrackOriginEnum storage)
Rescans desired storage for music files and adds them to the library. Asynchronous operation. Does nothing when the rescan is already running.

Parameters:
storage - the storage type.

getBackend

public DBStrategy getBackend()
Returns database backend object. Useful for selections.

Returns:
db backend object.

close

public void close()
Closes this instance of the library.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getStatistics

public Statistics getStatistics(TrackOriginEnum origin)
Returns statistics for storage for given origin.

Parameters:
origin - the track origin. Currently only TrackOriginEnum.Magnatune is supported.
Returns:
statistics.

getGenreCount

public int getGenreCount()
Returns overall genre count.

Returns:
known genre count.


Copyright © 2007-2009. All Rights Reserved.