aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005/dsub/service/RESTMusicService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005/dsub/service/RESTMusicService.java')
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index eeddcaa2..10647d99 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -88,6 +88,7 @@ import github.daneren2005.dsub.service.parser.SearchResult2Parser;
import github.daneren2005.dsub.service.parser.SearchResultParser;
import github.daneren2005.dsub.service.parser.ShareParser;
import github.daneren2005.dsub.service.parser.StarredListParser;
+import github.daneren2005.dsub.service.parser.UserParser;
import github.daneren2005.dsub.service.parser.VersionParser;
import github.daneren2005.dsub.service.ssl.SSLSocketFactory;
import github.daneren2005.dsub.service.ssl.TrustSelfSignedStrategy;
@@ -1190,6 +1191,34 @@ public class RESTMusicService implements MusicService {
}
@Override
+ public User getUser(boolean refresh, String username, Context context, ProgressListener progressListener) throws Exception {
+ Reader reader = getReader(context, progressListener, "getUser", null, Arrays.asList("username"), Arrays.<Object>asList(username));
+ try {
+ List<User> users = new UserParser(context).parse(reader, progressListener);
+ if(users.size() > 0) {
+ // Should only have returned one anyways
+ return users.get(0);
+ } else {
+ return null;
+ }
+ } finally {
+ Util.close(reader);
+ }
+ }
+
+ @Override
+ public List<User> getUsers(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
+ checkServerVersion(context, "1.8", "Getting user list is not supported");
+
+ Reader reader = getReader(context, progressListener, "getUsers", null);
+ try {
+ return new UserParser(context).parse(reader, progressListener);
+ } finally {
+ Util.close(reader);
+ }
+ }
+
+ @Override
public int processOfflineSyncs(final Context context, final ProgressListener progressListener) throws Exception{
return processOfflineScrobbles(context, progressListener) + processOfflineStars(context, progressListener);
}