aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java2
-rw-r--r--src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java12
2 files changed, 10 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
index ef17cf5d..82120b56 100644
--- a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
+++ b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
@@ -66,7 +66,7 @@ public class MostRecentSyncAdapter extends SubsonicSyncAdapter {
for(MusicDirectory.Entry album: albumList.getChildren()) {
if(!syncedList.contains(album.getId())) {
try {
- downloadRecursively(musicService.getMusicDirectory(album.getId(), album.getTitle(), true, context, null), context, false);
+ downloadRecursively(null, musicService.getMusicDirectory(album.getId(), album.getTitle(), true, context, null), context, false);
syncedList.add(album.getId());
updated = true;
} catch(Exception e) {
diff --git a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
index ee157771..1c45d8e1 100644
--- a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
+++ b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
@@ -34,6 +34,8 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
+import java.util.List;
+
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.service.RESTMusicService;
@@ -117,18 +119,22 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
}
- protected void downloadRecursively(MusicDirectory parent, Context context, boolean save) throws Exception {
+ protected void downloadRecursively(List<String> paths, MusicDirectory parent, Context context, boolean save) throws Exception {
for (MusicDirectory.Entry song: parent.getChildren(false, true)) {
if (!song.isVideo()) {
DownloadFile file = new DownloadFile(context, song, save);
- while(!file.isCompleteFileAvailable() && !file.isFailedMax()) {
+ while(!(save && file.isSaved() || !save && file.isCompleteFileAvailable()) && !file.isFailedMax()) {
file.downloadNow(musicService);
}
+
+ if(paths != null && file.isCompleteFileAvailable()) {
+ paths.add(file.getCompleteFile().getPath());
+ }
}
}
for (MusicDirectory.Entry dir: parent.getChildren(true, false)) {
- downloadRecursively(musicService.getMusicDirectory(dir.getId(), dir.getTitle(), true, context, null), context, save);
+ downloadRecursively(paths, musicService.getMusicDirectory(dir.getId(), dir.getTitle(), true, context, null), context, save);
}
}
}