diff options
author | Scott Jackson <daneren2005@gmail.com> | 2012-10-23 18:31:06 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2012-10-23 18:31:06 -0700 |
commit | 22ac4d38c09273a7bcedadce033ecb9f443ad2b4 (patch) | |
tree | 8a93892bd5ec9aa6c4abd1077cfc637a69cfceaa /subsonic-android/src/github | |
parent | 1219296b3df42ea40539051dc24a2e00bd4ef436 (diff) | |
download | dsub-22ac4d38c09273a7bcedadce033ecb9f443ad2b4.tar.gz dsub-22ac4d38c09273a7bcedadce033ecb9f443ad2b4.tar.bz2 dsub-22ac4d38c09273a7bcedadce033ecb9f443ad2b4.zip |
Fixed getRandomSongs when no musicFolderId is passed in
Diffstat (limited to 'subsonic-android/src/github')
-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()); |