aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-12-11 20:51:24 -0800
committerScott Jackson <daneren2005@gmail.com>2013-12-11 20:51:24 -0800
commit223e50347502bb66041b4881e110fe4b7f1cee77 (patch)
tree791172548f4d445a63d160b547c2c7dd6f2584ea /src
parent8893f21e290805ad9b571d1208ea286cd7192960 (diff)
downloaddsub-223e50347502bb66041b4881e110fe4b7f1cee77.tar.gz
dsub-223e50347502bb66041b4881e110fe4b7f1cee77.tar.bz2
dsub-223e50347502bb66041b4881e110fe4b7f1cee77.zip
Added ability to specify list for path retrieval, fix saved logic
Diffstat (limited to 'src')
-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);
}
}
}