|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.baka.ambient.collection.local.MediaStoreCollection
public final class MediaStoreCollection
Wrapper for Android MediaStore class.
| Field Summary | |
|---|---|
(package private) static java.lang.String[] |
TRACK_COLUMNS
Columns used when retrieving tracks from MediaStore. |
| Constructor Summary | |
|---|---|
MediaStoreCollection(android.content.ContentResolver resolver)
Creates new collection wrapper. |
|
| Method Summary | |
|---|---|
CategoryItem |
deserializeItem(java.lang.String serializedItem)
Deserializes item serialized by ICollection.serializeItem(CategoryItem). |
java.util.List<TrackMetadataBean> |
findTracks(java.util.Map<CategoryEnum,java.lang.String> criteria)
Search for tracks using given criteria search. |
java.util.List<TrackMetadataBean> |
findTracks(java.lang.String substring)
A simpler version of ICollection.findTracks(Map). |
java.util.Map<java.lang.String,java.lang.String> |
fixLocations(java.util.Collection<java.lang.String> locations)
Given locations became invalid and need fixing. |
java.util.List<CategoryItem> |
getCategoryList(CategoryEnum request,
CategoryItem context,
java.lang.String substring,
boolean sortByYear)
Returns category list matching given criteria. |
java.lang.String |
getName()
Returns short descriptive name of this collection backend. |
Statistics |
getStatistics()
Returns statistics for this collection. |
java.util.List<TrackMetadataBean> |
getTracks(CategoryItem context)
Returns all tracks contained in given category. |
boolean |
isLocal()
Checks if the underlying strategy uses local resources to retrieve metadata (a DB backend), or it uses remote access to a server (for example Ampache). |
IDynamicPlaylistTrackProvider |
newTrackProvider(Random random)
Returns a new instance of the track provider. |
(package private) static TrackMetadataBean |
readTrack(android.database.Cursor c,
android.net.Uri contentUri)
Reads a single track from current cursor position. |
(package private) static java.util.List<TrackMetadataBean> |
readTracks(android.database.Cursor c,
android.net.Uri contentUri)
Reads tracks from given cursor. |
java.lang.String |
serializeItem(CategoryItem item)
Returns ID returned by this collection in the CategoryItem.id as
String. |
boolean |
supportsLocationFix()
Serves for optimalization purposes only: checks if this collection can perform obsolete locations fixup or
not. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final java.lang.String[] TRACK_COLUMNS
MediaStore.
| Constructor Detail |
|---|
public MediaStoreCollection(android.content.ContentResolver resolver)
resolver - resolves URI. Must not be null.| Method Detail |
|---|
public CategoryItem deserializeItem(java.lang.String serializedItem)
ICollectionICollection.serializeItem(CategoryItem).
This item will be used to perform search only. This functionality is only
used by AmpacheServer. You do not need to store the
CategoryItem.category - it will be overwritten.
deserializeItem in interface ICollectionserializedItem - the item to deserialize
public java.util.List<CategoryItem> getCategoryList(CategoryEnum request,
CategoryItem context,
java.lang.String substring,
boolean sortByYear)
throws CollectionException,
java.lang.InterruptedException
ICollection
getCategoryList in interface ICollectionrequest - the category to search for. Must not be null.context - search in context of this item. May be null - in
this case all categories are returned.substring - if not null then all category names must contain
this substring.sortByYear - if true then the result category list is sorted
by year, then by CategoryItem.sortKey. If
false then sorted only by
CategoryItem.sortKey. Ignored when the
request parameter is not an album.
null, may be empty.
Not required to be thread-safe. Sorted depending on the value of
the sortByYear parameter.
CollectionException - thrown when the collection fails to return items.
java.lang.InterruptedException - when interrupted.public java.lang.String getName()
ICollection
getName in interface ICollectionpublic Statistics getStatistics()
ICollection
getStatistics in interface ICollectionnull.
public java.util.List<TrackMetadataBean> getTracks(CategoryItem context)
throws CollectionException,
java.lang.InterruptedException
ICollection
getTracks in interface ICollectioncontext - search in context of this item. Must not be null.
null, may be empty. Not required to be thread-safe.
Sorted in no particular order.
CollectionException - thrown when the collection fails to return items.
java.lang.InterruptedException - when interrupted.
static java.util.List<TrackMetadataBean> readTracks(android.database.Cursor c,
android.net.Uri contentUri)
throws java.lang.InterruptedException
TRACK_COLUMNS.
c - the cursor to poll. Closed when the method finishes.contentUri - uses this URI when setting the location of retrieved tracks
java.lang.InterruptedException
static TrackMetadataBean readTrack(android.database.Cursor c,
android.net.Uri contentUri)
TRACK_COLUMNS.
c - the cursor to poll. The cursor is not moved.contentUri - uses this URI when setting the location of retrieved tracks
public boolean isLocal()
ICollection
isLocal in interface ICollectiontrue if the collection queries will tend to be
performed fast, false otherwise.
public java.util.List<TrackMetadataBean> findTracks(java.lang.String substring)
throws java.lang.InterruptedException
ICollectionICollection.findTracks(Map). Search song which Song
Title, Artist Name, Album Name or Genre Name contains given substring.
findTracks in interface ICollectionsubstring - the substring to search for.
null, may be empty.
Sorted in no particular order. Not required to be thread-safe.
java.lang.InterruptedException - when interrupted.public java.lang.String serializeItem(CategoryItem item)
ICollectionCategoryItem.id as
String. This item will only be used to perform searches - you should thus
preserve minimum information from the category item. This functionality
is only used by AmpacheServer. You do not need to store the
CategoryItem.category - it will be overwritten.
serializeItem in interface ICollectionitem - the item to convert
public IDynamicPlaylistTrackProvider newTrackProvider(Random random)
ICollectionnull if this collection does not provide this functionality.
It is caller's responsibility to close the provider.
newTrackProvider in interface ICollectionrandom - initially provide tracks using this random value.
null.
public java.util.List<TrackMetadataBean> findTracks(java.util.Map<CategoryEnum,java.lang.String> criteria)
throws java.lang.InterruptedException
ICollection
findTracks in interface ICollectioncriteria - the criteria, must not be null. AND operator is
used if multiple criteria are specified. String values are
matched as substrings.
java.lang.InterruptedException - when interrupted.public java.util.Map<java.lang.String,java.lang.String> fixLocations(java.util.Collection<java.lang.String> locations)
ICollectionGiven locations became invalid and need fixing.
MediaPlayer detected an error while playing first location URL
from given location list. All given locations might thus have become
invalid. The collection is asked to fix these locations: it should
re-connect to the server (if any) and/or perform any required steps. If
any of these locations became completely invalid the method is free to
omit them in the result map. If the collection is unable to fix given
location then just pass input location.
Invoked asynchronously. This method will receive only locations provided
earlier by track lookup methods such as
ICollection.findTracks(Map).
fixLocations in interface ICollectionlocations - the list of (possibly) invalid locations. Never
null nor empty.
null. Not required to be thread-safe.public boolean supportsLocationFix()
ICollectionobsolete locations fixup or
not.
supportsLocationFix in interface ICollectiontrue if ICollection.fixLocations(Collection) is
supported, false if the collection cannot fix the
locations, or the fix operation is not applicable to this
collection.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||