diff options
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java | 15 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index fd418438..fd323119 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -467,11 +467,22 @@ public class RESTMusicService implements MusicService { } @Override - public MusicDirectory getRandomSongs(int size, String folder, Context context, ProgressListener progressListener) throws Exception { + public MusicDirectory getRandomSongs(int size, String musicFolderId, Context context, ProgressListener progressListener) throws Exception { HttpParams params = new BasicHttpParams(); HttpConnectionParams.setSoTimeout(params, SOCKET_READ_TIMEOUT_GET_RANDOM_SONGS); + + List<String> names = new ArrayList<String>(); + List<Object> values = new ArrayList<Object>(); + + names.add("size"); + values.add(size); + + if (musicFolderId != null) { + names.add("musicFolderId"); + values.add(musicFolderId); + } - Reader reader = getReader(context, progressListener, "getRandomSongs", params, Arrays.asList("size", "musicFolderId"), Arrays.<Object>asList(size, folder)); + Reader reader = getReader(context, progressListener, "getRandomSongs", params, names, values); try { return new RandomSongsParser(context).parse(reader, progressListener); } finally { diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java b/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java index 673af466..47bbe655 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/ShufflePlayBuffer.java @@ -86,7 +86,7 @@ public class ShufflePlayBuffer { try { MusicService service = MusicServiceFactory.getMusicService(context); int n = CAPACITY - buffer.size(); - MusicDirectory songs = service.getRandomSongs(n, context, null); + MusicDirectory songs = service.getRandomSongs(n, null, context, null); synchronized (buffer) { buffer.addAll(songs.getChildren()); |