diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-09-24 22:19:16 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-09-24 22:19:16 -0700 |
commit | 11daf1ae1a5673ede8cf63d464881a4491ad5690 (patch) | |
tree | 2cef50796077453dae13aa4dcb60c61984131628 | |
parent | 16fd8b69380116422284e504cf5d48aceb219051 (diff) | |
download | dsub-11daf1ae1a5673ede8cf63d464881a4491ad5690.tar.gz dsub-11daf1ae1a5673ede8cf63d464881a4491ad5690.tar.bz2 dsub-11daf1ae1a5673ede8cf63d464881a4491ad5690.zip |
Missed in last commit
-rw-r--r-- | src/github/daneren2005/dsub/service/CachedMusicService.java | 24 |
1 files 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 |