use of org.moire.ultrasonic.domain.MusicDirectory in project ultrasonic by ultrasonic.
the class SelectAlbumActivity method getShare.
private void getShare(final String shareId, final CharSequence shareName) {
setActionBarSubtitle(shareName);
new LoadTask() {
@Override
protected MusicDirectory load(MusicService service) throws Exception {
List<Share> shares = service.getShares(true, SelectAlbumActivity.this, this);
MusicDirectory md = new MusicDirectory();
for (Share share : shares) {
if (share.getId().equals(shareId)) {
for (MusicDirectory.Entry entry : share.getEntries()) {
md.addChild(entry);
}
break;
}
}
return md;
}
}.execute();
}
use of org.moire.ultrasonic.domain.MusicDirectory in project ultrasonic by ultrasonic.
the class CachedMusicService method getVideos.
@Override
public MusicDirectory getVideos(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
checkSettingsChanged(context);
TimeLimitedCache<MusicDirectory> cache = refresh ? null : cachedMusicDirectories.get(Constants.INTENT_EXTRA_NAME_VIDEOS);
MusicDirectory dir = cache == null ? null : cache.get();
if (dir == null) {
dir = musicService.getVideos(refresh, context, progressListener);
cache = new TimeLimitedCache<MusicDirectory>(Util.getDirectoryCacheTime(context), TimeUnit.SECONDS);
cache.set(dir);
cachedMusicDirectories.put(Constants.INTENT_EXTRA_NAME_VIDEOS, cache);
}
return dir;
}
use of org.moire.ultrasonic.domain.MusicDirectory in project ultrasonic by ultrasonic.
the class CachedMusicService method getMusicDirectory.
@Override
public MusicDirectory getMusicDirectory(String id, String name, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
checkSettingsChanged(context);
TimeLimitedCache<MusicDirectory> cache = refresh ? null : cachedMusicDirectories.get(id);
MusicDirectory dir = cache == null ? null : cache.get();
if (dir == null) {
dir = musicService.getMusicDirectory(id, name, refresh, context, progressListener);
cache = new TimeLimitedCache<MusicDirectory>(Util.getDirectoryCacheTime(context), TimeUnit.SECONDS);
cache.set(dir);
cachedMusicDirectories.put(id, cache);
}
return dir;
}
Aggregations