From 11daf1ae1a5673ede8cf63d464881a4491ad5690 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 24 Sep 2013 22:19:16 -0700 Subject: Missed in last commit --- .../dsub/service/CachedMusicService.java | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 4b17d2c8..a76dea85 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -151,8 +151,16 @@ public class CachedMusicService implements MusicService { } @Override - public MusicDirectory getPlaylist(String id, String name, Context context, ProgressListener progressListener) throws Exception { - return musicService.getPlaylist(id, name, context, progressListener); + public MusicDirectory getPlaylist(boolean refresh, String id, String name, Context context, ProgressListener progressListener) throws Exception { + MusicDirectory dir = null; + if(!refresh) { + dir = FileUtil.deserialize(context, getCacheName(context, "playlist", id), MusicDirectory.class); + } + if(dir == null) { + dir = musicService.getPlaylist(refresh, id, name, context, progressListener); + FileUtil.serialize(context, dir, getCacheName(context, "playlist", id)); + } + return dir; } @Override @@ -362,8 +370,16 @@ public class CachedMusicService implements MusicService { } @Override - public MusicDirectory getPodcastEpisodes(String id, Context context, ProgressListener progressListener) throws Exception { - return musicService.getPodcastEpisodes(id, context, progressListener); + public MusicDirectory getPodcastEpisodes(boolean refresh, String id, Context context, ProgressListener progressListener) throws Exception { + MusicDirectory dir = null; + if(!refresh) { + dir = FileUtil.deserialize(context, getCacheName(context, "podcast", id), MusicDirectory.class); + } + if(dir == null) { + dir = musicService.getPodcastEpisodes(refresh, id, context, progressListener); + FileUtil.serialize(context, dir, getCacheName(context, "podcast", id)); + } + return dir; } @Override -- cgit v1.2.3