aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2014-05-19 15:19:21 -0700
committerdaneren2005 <daneren2005@gmail.com>2014-05-19 15:19:21 -0700
commitc395bfbdc91fa8d2f1bfbbd14bb767a833dcad19 (patch)
treec2c558f4d4db04166231ed144545a40257746930 /src
parentc14aed4b2641b81d09f8e079a8c6d71767c46efe (diff)
downloaddsub-c395bfbdc91fa8d2f1bfbbd14bb767a833dcad19.tar.gz
dsub-c395bfbdc91fa8d2f1bfbbd14bb767a833dcad19.tar.bz2
dsub-c395bfbdc91fa8d2f1bfbbd14bb767a833dcad19.zip
Fix sync adapters when server is tag browsing
Sync adapters were always expecting to use getMusicDirectory, but both getStarred and getAlbumList will be returning id's for getArtist/getAlbum if the user is browsing by tags on that server.
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
index eccdaee2..c08dab2e 100644
--- a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
+++ b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java
@@ -50,6 +50,7 @@ import github.daneren2005.dsub.util.Util;
public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
private static final String TAG = SubsonicSyncAdapter.class.getSimpleName();
protected CachedMusicService musicService = new CachedMusicService(new RESTMusicService());
+ protected boolean tagBrowsing;
private Context context;
public SubsonicSyncAdapter(Context context, boolean autoInitialize) {
@@ -108,6 +109,7 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
for(int i = 1; i <= servers; i++) {
try {
if(isValidServer(context, i)) {
+ tagBrowsing = Util.isTagBrowsing(context, instance);
musicService.setInstance(i);
onExecuteSync(context, i);
}
@@ -139,7 +141,21 @@ public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter {
}
for (MusicDirectory.Entry dir: parent.getChildren(true, false)) {
- if(downloadRecursively(paths, musicService.getMusicDirectory(dir.getId(), dir.getTitle(), true, context, null), context, save)) {
+ 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)) {
downloaded = true;
}
}