sk.baka.ambient.library
Class Library

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

public final class Library
extends Object

The music library. Emits ILibraryListener messages on events.

Author:
Martin Vysny

Field Summary
(package private)  DBStrategy backend
          The database back-end.
 Set<String> watchedDirectories
          List of watched directories.
 
Constructor Summary
Library(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.
 File[] getWatchedDirectories()
          Returns the watchedDirectories set as a list of files.
 void queueScanner(TrackOriginEnum storage)
          Rescans desired storage for music files and adds them to the library.
 void setWatchedDirectories(String directoryList)
          Parses given directory list and sets watchedDirectories accordingly.
 
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.


watchedDirectories

public Set<String> watchedDirectories
List of watched directories. One directory should not be a subdirectory of another.

Constructor Detail

Library

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

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

setWatchedDirectories

public void setWatchedDirectories(String directoryList)
Parses given directory list and sets watchedDirectories accordingly. Does not rescan the collection.

Parameters:
directoryList - the list of directories, separated with ':'

getWatchedDirectories

public File[] getWatchedDirectories()
Returns the watchedDirectories set as a list of files.

Returns:
the list of watched directories.

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 Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getStatistics

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

Parameters:
origin - the track origin
Returns:
statistics.

getGenreCount

public int getGenreCount()
Returns overall genre count.

Returns:
known genre count.


Copyright © 2007-2008. All Rights Reserved.