From 6ad4c29a79c3c405fb6a6f28ee3fba5bf7431c8c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 12 Dec 2013 22:12:47 -0800 Subject: Refresh listings in various sync adapters to give illusion of dynamic content --- .../daneren2005/dsub/service/sync/MostRecentSyncAdapter.java | 5 +++++ src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java | 8 ++++++++ src/github/daneren2005/dsub/service/sync/PodcastSyncAdapter.java | 3 +++ 3 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java index 82120b56..7bead10b 100644 --- a/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java @@ -78,6 +78,11 @@ public class MostRecentSyncAdapter extends SubsonicSyncAdapter { if(updated) { FileUtil.serialize(context, syncedList, SyncUtil.getMostRecentSyncFile(context, instance)); + + // If there is a new album on the active server, chances are artists need to be refreshed + if(Util.getActiveServer(context) == instance) { + musicService.getIndexes(Util.getSelectedMusicFolderId(context), true, context, null); + } } } catch(Exception e) { Log.e(TAG, "Failed to get most recent list for " + Util.getServerName(context, instance)); diff --git a/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java index 6e3b49c3..6724e561 100644 --- a/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java @@ -49,6 +49,14 @@ public class PlaylistSyncAdapter extends SubsonicSyncAdapter { @Override public void onExecuteSync(Context context, int instance) { String serverName = Util.getServerName(context, instance); + + try { + // Just update playlist listings so user doesn't have to + musicService.getPlaylists(true, context, null); + } catch(Exception e) { + Log.e(TAG, "Failed to refresh playlist list for " + serverName); + } + List playlistList = SyncUtil.getSyncedPlaylists(context, instance); for(int i = 0; i < playlistList.size(); i++) { String id = playlistList.get(i); diff --git a/src/github/daneren2005/dsub/service/sync/PodcastSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/PodcastSyncAdapter.java index b5d39d72..4826c214 100644 --- a/src/github/daneren2005/dsub/service/sync/PodcastSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/PodcastSyncAdapter.java @@ -61,6 +61,9 @@ public class PodcastSyncAdapter extends SubsonicSyncAdapter { if(podcastList.size() > 0) { // Refresh podcast listings before syncing musicService.refreshPodcasts(context, null); + + // Just update podcast listings so user doesn't have to + musicService.getPodcastChannels(true, context, null); } boolean updated = false; -- cgit v1.2.3