From 7b1da2e065fc324f4b490fa6e98daf6e591a33d9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 19 May 2014 22:38:48 -0700 Subject: Fix most recent sync with tags, make sure to use tag check on first result as well --- .../dsub/service/sync/MostRecentSyncAdapter.java | 2 +- .../dsub/service/sync/SubsonicSyncAdapter.java | 32 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') 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 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); -- cgit v1.2.3