aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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.java32
2 files changed, 17 insertions, 17 deletions
diff --git a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
index 09194d25..0801bf7c 100644
--- a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
+++ b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
@@ -69,7 +69,7 @@ public class MostRecentSyncAdapter extends SubsonicSyncAdapter {
if(!syncedList.contains(album.getId())) {
if(!"Podcast".equals(album.getGenre())) {
try {
- if(downloadRecursively(null, musicService.getMusicDirectory(album.getId(), album.getTitle(), true, context, null), context, false)) {
+ if(downloadRecursively(null, getMusicDirectory(album), context, false)) {
updated.add(album.getTitle());
}
} catch(Exception e) {
diff --git a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
index 905277e9..d0b3b706 100644
--- a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
+++ b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
@@ -123,7 +123,7 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
public void onExecuteSync(Context context, int instance) {
}
-
+
protected boolean downloadRecursively(List<String> paths, MusicDirectory parent, Context context, boolean save) throws Exception {
boolean downloaded = false;
for (MusicDirectory.Entry song: parent.getChildren(false, true)) {
@@ -141,27 +141,27 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
}
for (MusicDirectory.Entry dir: parent.getChildren(true, false)) {
- String id = dir.getId();
- String name = dir.getTitle();
-
- MusicDirectory contents;
- if(tagBrowsing) {
- if(dir.getParent() == null || dir.getArtist() == null) {
- contents = musicService.getArtist(id, name, true, context, null);
- } else {
- contents = musicService.getAlbum(id, name, true, context, null);
- }
- } else {
- contents = musicService.getMusicDirectory(id, name, true, context, null);
- }
-
- if(downloadRecursively(paths, contents, context, save)) {
+ if(downloadRecursively(paths, getMusicDirectory(dir), context, save)) {
downloaded = true;
}
}
return downloaded;
}
+ protected MusicDirectory getMusicDirectory(MusicDirectory.Entry dir) throws Exception{
+ String id = dir.getId();
+ String name = dir.getTitle();
+
+ if(tagBrowsing) {
+ if(dir.getArtist() == null) {
+ return musicService.getArtist(id, name, true, context, null);
+ } else {
+ return musicService.getAlbum(id, name, true, context, null);
+ }
+ } else {
+ return musicService.getMusicDirectory(id, name, true, context, null);
+ }
+ }
private boolean isValidServer(Context context, int instance) {
String url = Util.getRestUrl(context, "null", instance, false);