From 1f982aa8feff78afe099ea4721438f0ae126de4a Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Mon, 9 Dec 2013 16:05:09 -0800 Subject: Add downloadRecursively to SubsonicSyncAdapter --- .../dsub/service/sync/SubsonicSyncAdapter.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') 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); + } + } } -- cgit v1.2.3