From 9f8c55fb9692c148bca38f265a706724074fa418 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 17 Oct 2012 18:54:24 -0700 Subject: Start of work for add to playlist --- .../daneren2005/dsub/activity/SelectAlbumActivity.java | 3 +++ .../src/github/daneren2005/dsub/service/MusicService.java | 2 ++ .../daneren2005/dsub/service/OfflineMusicService.java | 5 +++++ .../github/daneren2005/dsub/service/RESTMusicService.java | 14 ++++++++++++++ 4 files changed, 24 insertions(+) (limited to 'subsonic-android/src/github') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java index 2ad4e2bb..01b73d85 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -163,6 +163,9 @@ public class SelectAlbumActivity extends SubsonicTabActivity { case R.id.menu_delete: delete(); selectAll(false, false); + return true; + case R.id.menu_add_playlist: + return true; case R.id.menu_exit: intent = new Intent(this, MainActivity.class); diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java index 15abbdf8..a675e2ea 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java @@ -92,4 +92,6 @@ public interface MusicService { JukeboxStatus setJukeboxGain(float gain, Context context, ProgressListener progressListener) throws Exception; void setStarred(String id, boolean starred, Context context, ProgressListener progressListener) throws Exception; + + void updatePlaylist(String id, String name, String comment, List toAdd, Context context, ProgressListener progressListener) throws Exception; } \ No newline at end of file diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java index f574572d..f4a6bcf0 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -313,6 +313,11 @@ public class OfflineMusicService extends RESTMusicService { public void setStarred(String id, boolean starred, Context context, ProgressListener progressListener) throws Exception { throw new OfflineException("Starring not available in offline mode"); } + + @Override + public void updatePlaylist(String id, String name, String comment, List toAdd, Context context, ProgressListener progressListener) throws Exception { + throw new OfflineException("Updating playlist not available in offline mode"); + } @Override public MusicDirectory getRandomSongs(int size, Context context, ProgressListener progressListener) throws Exception { diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index a993df0d..92348332 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -74,6 +74,7 @@ import github.daneren2005.dsub.domain.Indexes; import github.daneren2005.dsub.domain.JukeboxStatus; import github.daneren2005.dsub.domain.Lyrics; import github.daneren2005.dsub.domain.MusicDirectory; +import github.daneren2005.dsub.domain.MusicDirectory.Entry; import github.daneren2005.dsub.domain.MusicFolder; import github.daneren2005.dsub.domain.Playlist; import github.daneren2005.dsub.domain.SearchCritera; @@ -624,6 +625,19 @@ public class RESTMusicService implements MusicService { Util.close(reader); } } + + @Override + public void updatePlaylist(String id, String name, String comment, List toAdd, Context context, ProgressListener progressListener) throws Exception { + List names = Arrays.asList("playListID", "name", "comment"); + List values = Arrays.asList(id, name, comment); + checkServerVersion(context, "1.8", "Updating playlists is not supported."); + Reader reader = getReader(context, progressListener, "updatePlaylist", null, names, values); + try { + new ErrorParser(context).parse(reader); + } finally { + Util.close(reader); + } + } private Reader getReader(Context context, ProgressListener progressListener, String method, HttpParams requestParams) throws Exception { return getReader(context, progressListener, method, requestParams, Collections.emptyList(), Collections.emptyList()); -- cgit v1.2.3