aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-09-24 22:19:01 -0700
committerScott Jackson <daneren2005@gmail.com>2013-09-24 22:19:01 -0700
commit16fd8b69380116422284e504cf5d48aceb219051 (patch)
tree5db34ddb9aad3df4f6bd3353eac8417e2e14aacc /src
parent36beac52466e86fe428c77101128c6ee7edb961d (diff)
downloaddsub-16fd8b69380116422284e504cf5d48aceb219051.tar.gz
dsub-16fd8b69380116422284e504cf5d48aceb219051.tar.bz2
dsub-16fd8b69380116422284e504cf5d48aceb219051.zip
Closes #159: Serialize playlist/podcast lists as well
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java13
-rw-r--r--src/github/daneren2005/dsub/fragments/SubsonicFragment.java4
-rw-r--r--src/github/daneren2005/dsub/service/MusicService.java4
-rw-r--r--src/github/daneren2005/dsub/service/OfflineMusicService.java4
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java4
5 files changed, 14 insertions, 15 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 835d7ed8..2d095c6e 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -14,7 +14,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
-import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import github.daneren2005.dsub.R;
@@ -335,9 +334,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
entryList.setVisibility(View.INVISIBLE);
emptyView.setVisibility(View.INVISIBLE);
if (playlistId != null) {
- getPlaylist(playlistId, playlistName);
+ getPlaylist(playlistId, playlistName, refresh);
} else if(podcastId != null) {
- getPodcast(podcastId, podcastName);
+ getPodcast(podcastId, podcastName, refresh);
} else if (albumListType != null) {
getAlbumList(albumListType, albumListSize);
} else {
@@ -356,24 +355,24 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}.execute();
}
- private void getPlaylist(final String playlistId, final String playlistName) {
+ private void getPlaylist(final String playlistId, final String playlistName, final boolean refresh) {
setTitle(playlistName);
new LoadTask() {
@Override
protected MusicDirectory load(MusicService service) throws Exception {
- return service.getPlaylist(playlistId, playlistName, context, this);
+ return service.getPlaylist(refresh, playlistId, playlistName, context, this);
}
}.execute();
}
- private void getPodcast(final String podcastId, final String podcastName) {
+ private void getPodcast(final String podcastId, final String podcastName, final boolean refresh) {
setTitle(podcastName);
new LoadTask() {
@Override
protected MusicDirectory load(MusicService service) throws Exception {
- return service.getPodcastEpisodes(podcastId, context, this);
+ return service.getPodcastEpisodes(refresh, podcastId, context, this);
}
}.execute();
}
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
index 0d79ceda..b6b57a44 100644
--- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java
@@ -587,7 +587,7 @@ public class SubsonicFragment extends Fragment {
if(isDirectory)
root = musicService.getMusicDirectory(id, name, false, context, this);
else
- root = musicService.getPlaylist(id, name, context, this);
+ root = musicService.getPlaylist(true, id, name, context, this);
List<MusicDirectory.Entry> songs = new LinkedList<MusicDirectory.Entry>();
getSongsRecursively(root, songs);
return songs;
@@ -792,7 +792,7 @@ public class SubsonicFragment extends Fragment {
@Override
protected Void doInBackground() throws Throwable {
MusicService musicService = MusicServiceFactory.getMusicService(context);
- MusicDirectory playlist = musicService.getPlaylist(id, name, context, null);
+ MusicDirectory playlist = musicService.getPlaylist(true, id, name, context, null);
List<MusicDirectory.Entry> toDelete = playlist.getChildren();
musicService.overwritePlaylist(id, name, toDelete.size(), songs, context, null);
return null;
diff --git a/src/github/daneren2005/dsub/service/MusicService.java b/src/github/daneren2005/dsub/service/MusicService.java
index cae307cb..6db960e6 100644
--- a/src/github/daneren2005/dsub/service/MusicService.java
+++ b/src/github/daneren2005/dsub/service/MusicService.java
@@ -59,7 +59,7 @@ public interface MusicService {
MusicDirectory getStarredList(Context context, ProgressListener progressListener) throws Exception;
- MusicDirectory getPlaylist(String id, String name, Context context, ProgressListener progressListener) throws Exception;
+ MusicDirectory getPlaylist(boolean refresh, String id, String name, Context context, ProgressListener progressListener) throws Exception;
List<Playlist> getPlaylists(boolean refresh, Context context, ProgressListener progressListener) throws Exception;
@@ -123,7 +123,7 @@ public interface MusicService {
List<PodcastChannel> getPodcastChannels(boolean refresh, Context context, ProgressListener progressListener) throws Exception;
- MusicDirectory getPodcastEpisodes(String id, Context context, ProgressListener progressListener) throws Exception;
+ MusicDirectory getPodcastEpisodes(boolean refresh, String id, Context context, ProgressListener progressListener) throws Exception;
void refreshPodcasts(Context context, ProgressListener progressListener) throws Exception;
diff --git a/src/github/daneren2005/dsub/service/OfflineMusicService.java b/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 3bab2fc8..8e604bfa 100644
--- a/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -378,7 +378,7 @@ public class OfflineMusicService extends RESTMusicService {
}
@Override
- public MusicDirectory getPlaylist(String id, String name, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getPlaylist(boolean refresh, String id, String name, Context context, ProgressListener progressListener) throws Exception {
DownloadService downloadService = DownloadServiceImpl.getInstance();
if (downloadService == null) {
return new MusicDirectory();
@@ -606,7 +606,7 @@ public class OfflineMusicService extends RESTMusicService {
}
@Override
- public MusicDirectory getPodcastEpisodes(String id, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getPodcastEpisodes(boolean refresh, String id, Context context, ProgressListener progressListener) throws Exception {
return getMusicDirectory(FileUtil.getPodcastDirectory(context, id).getPath(), null, false, context, progressListener);
}
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index 6c9dc5ba..09a1d6fe 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -313,7 +313,7 @@ public class RESTMusicService implements MusicService {
}
@Override
- public MusicDirectory getPlaylist(String id, String name, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getPlaylist(boolean refresh, String id, String name, Context context, ProgressListener progressListener) throws Exception {
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setSoTimeout(params, SOCKET_READ_TIMEOUT_GET_PLAYLIST);
@@ -904,7 +904,7 @@ public class RESTMusicService implements MusicService {
}
@Override
- public MusicDirectory getPodcastEpisodes(String id, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getPodcastEpisodes(boolean refresh, String id, Context context, ProgressListener progressListener) throws Exception {
Reader reader = getReader(context, progressListener, "getPodcasts", null, Arrays.asList("id"), Arrays.<Object>asList(id));
try {
return new PodcastEntryParser(context).parse(id, reader, progressListener);