diff options
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) { |