From a90c77104abca83bce2623170e1b050b76da2045 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 21 Oct 2012 15:09:50 -0700 Subject: Moved addToPlaylist next to other playlist functions --- .../daneren2005/dsub/service/MusicService.java | 4 +-- .../daneren2005/dsub/service/RESTMusicService.java | 34 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java index a6e20ca5..d6b88d83 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java @@ -60,6 +60,8 @@ public interface MusicService { List getPlaylists(boolean refresh, Context context, ProgressListener progressListener) throws Exception; void createPlaylist(String id, String name, List entries, Context context, ProgressListener progressListener) throws Exception; + + void addToPlaylist(String id, List toAdd, Context context, ProgressListener progressListener) throws Exception; Lyrics getLyrics(String artist, String title, Context context, ProgressListener progressListener) throws Exception; @@ -92,6 +94,4 @@ 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 addToPlaylist(String id, List toAdd, Context context, ProgressListener progressListener) throws Exception; } \ No newline at end of file diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index b95ae0f7..acd3010e 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -383,6 +383,23 @@ public class RESTMusicService implements MusicService { Util.close(reader); } } + + @Override + public void addToPlaylist(String id, List toAdd, Context context, ProgressListener progressListener) throws Exception { + checkServerVersion(context, "1.8", "Updating playlists is not supported."); + List names = Arrays.asList("playListID"); + List values = Arrays.asList(id); + for(MusicDirectory.Entry song: toAdd) { + names.add("songIdToAdd"); + values.add(song.getId()); + } + Reader reader = getReader(context, progressListener, "updatePlaylist", null, names, values); + try { + new ErrorParser(context).parse(reader); + } finally { + Util.close(reader); + } + } @Override public Lyrics getLyrics(String artist, String title, Context context, ProgressListener progressListener) throws Exception { @@ -625,23 +642,6 @@ public class RESTMusicService implements MusicService { Util.close(reader); } } - - @Override - public void addToPlaylist(String id, List toAdd, Context context, ProgressListener progressListener) throws Exception { - checkServerVersion(context, "1.8", "Updating playlists is not supported."); - List names = Arrays.asList("playListID"); - List values = Arrays.asList(id); - for(MusicDirectory.Entry song: toAdd) { - names.add("songIdToAdd"); - values.add(song.getId()); - } - 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