diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-12-27 17:31:09 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-12-27 17:31:09 -0800 |
commit | f012b3222b9341e8380edc79c05eba1b04c2d00a (patch) | |
tree | 6bf854f79a4481e3893f365b75263fc0209ce3a5 /src/github | |
parent | 5a6a3f84cf9541dce8fd6bdafccde8587098c5be (diff) | |
download | dsub-f012b3222b9341e8380edc79c05eba1b04c2d00a.tar.gz dsub-f012b3222b9341e8380edc79c05eba1b04c2d00a.tar.bz2 dsub-f012b3222b9341e8380edc79c05eba1b04c2d00a.zip |
#231 Fix sync adapters not serializing refreshes
Diffstat (limited to 'src/github')
4 files changed, 7 insertions, 6 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 3930fc3e..dfd2239e 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -57,7 +57,7 @@ public class CachedMusicService implements MusicService { private static final int MUSIC_DIR_CACHE_SIZE = 20; private static final int TTL_MUSIC_DIR = 5 * 60; // Five minutes - private final MusicService musicService; + private final RESTMusicService musicService; private final LruCache<String, TimeLimitedCache<MusicDirectory>> cachedMusicDirectories; private final TimeLimitedCache<Boolean> cachedLicenseValid = new TimeLimitedCache<Boolean>(120, TimeUnit.SECONDS); private final TimeLimitedCache<Indexes> cachedIndexes = new TimeLimitedCache<Indexes>(60 * 60, TimeUnit.SECONDS); @@ -67,7 +67,7 @@ public class CachedMusicService implements MusicService { private final TimeLimitedCache<List<PodcastChannel>> cachedPodcastChannels = new TimeLimitedCache<List<PodcastChannel>>(10 * 3600, TimeUnit.SECONDS); private String restUrl; - public CachedMusicService(MusicService musicService) { + public CachedMusicService(RESTMusicService musicService) { this.musicService = musicService; cachedMusicDirectories = new LruCache<String, TimeLimitedCache<MusicDirectory>>(MUSIC_DIR_CACHE_SIZE); } @@ -474,7 +474,7 @@ public class CachedMusicService implements MusicService { } private void checkSettingsChanged(Context context) { - String newUrl = Util.getRestUrl(context, null); + String newUrl = musicService.getRestUrl(context, null); if (!Util.equals(newUrl, restUrl)) { cachedMusicFolders.clear(); cachedMusicDirectories.evictAll(); diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index c37f02e5..348f3c1c 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -1362,7 +1362,7 @@ public class RESTMusicService implements MusicService { return networkInfo == null ? -1 : networkInfo.getType(); } - private String getRestUrl(Context context, String method) { + public String getRestUrl(Context context, String method) { if(instance == null) { return Util.getRestUrl(context, method); } else { diff --git a/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java index a1b20f73..ba4f34c9 100644 --- a/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/PlaylistSyncAdapter.java @@ -69,7 +69,7 @@ public class PlaylistSyncAdapter extends SubsonicSyncAdapter { SyncSet cachedPlaylist = playlistList.get(i);
String id = cachedPlaylist.id;
try {
- MusicDirectory playlist = musicService.getPlaylist(false, id, serverName, context, null);
+ MusicDirectory playlist = musicService.getPlaylist(true, id, serverName, context, null);
// Get list of original paths
List<String> origPathList = new ArrayList<String>();
diff --git a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java index 97a68835..a78b696e 100644 --- a/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java +++ b/src/github/daneren2005/dsub/service/sync/SubsonicSyncAdapter.java @@ -37,6 +37,7 @@ import android.util.Log; import java.util.List; import github.daneren2005.dsub.domain.MusicDirectory; +import github.daneren2005.dsub.service.CachedMusicService; import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.RESTMusicService; import github.daneren2005.dsub.util.Constants; @@ -48,7 +49,7 @@ import github.daneren2005.dsub.util.Util; public class SubsonicSyncAdapter extends AbstractThreadedSyncAdapter { private static final String TAG = SubsonicSyncAdapter.class.getSimpleName(); - protected RESTMusicService musicService = new RESTMusicService(); + protected CachedMusicService musicService = new CachedMusicService(new RESTMusicService()); private Context context; public SubsonicSyncAdapter(Context context, boolean autoInitialize) { |