|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.baka.ambient.collection.sync.SyncUtils
public final class SyncUtils
Utility class.
| Field Summary | |
|---|---|
ICollection |
downloadFrom
Download excess tracks from this collection. |
android.media.MediaScannerConnection |
msc
Connection to the media scanner. |
TagFormatter |
pathFormatter
produces a relative path where the music file should be stored. |
ICollection |
reference
This is the reference collection, i.e. |
| Constructor Summary | |
|---|---|
SyncUtils(ICollection reference,
ICollection downloadFrom,
TagFormatter pathFormatter,
android.media.MediaScannerConnection msc)
|
|
| Method Summary | |
|---|---|
void |
downloadTrack(java.lang.String rootPath,
TrackMetadataBean track)
Downloads given track. |
static TagFormatter |
newPathFormatter()
Returns a new instance of a default tag formatter. |
static void |
removeLocalTracks(java.util.Collection<TrackMetadataBean> tracks,
java.util.Collection<? extends TrackMetadataBean> localTracks)
Removes local tracks from given collection. |
static java.lang.String |
removeSlashes(java.lang.String str)
Since /sdcard is most probably a fat32 drive, we have to remove several characters beside slash. |
static TrackMetadataBean |
removeSlashes(TrackMetadataBean track)
Creates a new track with invalid characters removed from title, album name, artist name, genre, year released and track number. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final TagFormatter pathFormatter
public final ICollection reference
public final ICollection downloadFrom
public final android.media.MediaScannerConnection msc
| Constructor Detail |
|---|
public SyncUtils(ICollection reference,
ICollection downloadFrom,
TagFormatter pathFormatter,
android.media.MediaScannerConnection msc)
reference - This is the reference collection, i.e. tracks which are not to
be synchronized.downloadFrom - Download excess tracks from this collection.pathFormatter - produces a relative path where the music file should be
stored. Must produce valid paths! Paths are created
automatically.msc - after a successful track download the track will be reported
to Android scanner.| Method Detail |
|---|
public static TagFormatter newPathFormatter()
sync/artist/year album/tracknum title.ext.
null formatter instance.
public static void removeLocalTracks(java.util.Collection<TrackMetadataBean> tracks,
java.util.Collection<? extends TrackMetadataBean> localTracks)
tracks - the track list. Removes local tracks from this collection.localTracks - a list of local tracks.public static TrackMetadataBean removeSlashes(TrackMetadataBean track)
track - the track to fix
public static java.lang.String removeSlashes(java.lang.String str)
str - the string to remove invalid characters from.
public void downloadTrack(java.lang.String rootPath,
TrackMetadataBean track)
throws java.io.IOException
rootPath - prepend the formatted name with this path. Must not end with a slash.track - the track. Slashes are removed automatically.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||