Search in sources :

Example 21 with MusicDirectory

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();
}
Also used : MusicDirectory(org.moire.ultrasonic.domain.MusicDirectory) MusicService(org.moire.ultrasonic.service.MusicService) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Share(org.moire.ultrasonic.domain.Share)

Example 22 with MusicDirectory

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;
}
Also used : MusicDirectory(org.moire.ultrasonic.domain.MusicDirectory)

Example 23 with MusicDirectory

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;
}
Also used : MusicDirectory(org.moire.ultrasonic.domain.MusicDirectory)

Aggregations

MusicDirectory (org.moire.ultrasonic.domain.MusicDirectory)23 MusicService (org.moire.ultrasonic.service.MusicService)8 LinkedList (java.util.LinkedList)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Intent (android.content.Intent)2 View (android.view.View)2 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 PullToRefreshListView (com.handmark.pulltorefresh.library.PullToRefreshListView)2 Collection (java.util.Collection)2 Share (org.moire.ultrasonic.domain.Share)2 AlbumView (org.moire.ultrasonic.view.AlbumView)2 SongView (org.moire.ultrasonic.view.SongView)2 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1