diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-12-09 16:05:09 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-12-09 16:05:09 -0800 |
commit | 1f982aa8feff78afe099ea4721438f0ae126de4a (patch) | |
tree | 3b04d032839eac556330dfa8481b6b03eacbca6c | |
parent | 8ee3710b1d9e4a1e7a4d56bfd74d9d6a110c92d7 (diff) | |
download | dsub-1f982aa8feff78afe099ea4721438f0ae126de4a.tar.gz dsub-1f982aa8feff78afe099ea4721438f0ae126de4a.tar.bz2 dsub-1f982aa8feff78afe099ea4721438f0ae126de4a.zip |
Add downloadRecursively to SubsonicSyncAdapter
-rw-r--r-- | src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java index 4dc3ae11..27ecbb2c 100644 --- a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java @@ -114,4 +114,19 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter { public void onExecuteSync(Context context, int instance) { } + + protected void downloadRecursively(MusicDirectory.Entry parent, Context context) { + for (MusicDirectory.Entry parent: album.getChildren(false, true)) { + if (!song.isVideo()) { + DownloadFile file = new DownloadFile(context, song, true); + while(!file.isSaved() && !file.isFailedMax()) { + file.downloadNow(); + } + } + } + + for (MusicDirectory.Entry dir: parent.getChildren(true, false)) { + downloadRecursively(musicService.getMusicDirectory(dir.getId(), dir.getTitle(), true, context, null), context); + } + } } |