aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-09-05 14:53:37 -0700
committerScott Jackson <daneren2005@gmail.com>2015-09-05 14:53:37 -0700
commitb62f08ce2eb1a2d04392995d18c5c89aa478a158 (patch)
tree0fda4c3e491b6706e3e219ede9966efb5dfaa3c1 /app
parentc4c5298f4248e81deec4f3106dd36e1779f51199 (diff)
downloaddsub-b62f08ce2eb1a2d04392995d18c5c89aa478a158.tar.gz
dsub-b62f08ce2eb1a2d04392995d18c5c89aa478a158.tar.bz2
dsub-b62f08ce2eb1a2d04392995d18c5c89aa478a158.zip
#540 Add top tracks for stock Subsonic on 5.3+
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java3
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java3
3 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
index 07a86db4..cb871008 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
@@ -210,4 +210,7 @@ public class ServerInfo implements Serializable {
public static boolean canAlbumListPerFolder(Context context) {
return ServerInfo.checkServerVersion(context, "1.11") && !ServerInfo.isMadsonic(context) && !Util.isTagBrowsing(context);
}
+ public static boolean hasTopSongs(Context context) {
+ return ServerInfo.isMadsonic(context) || ServerInfo.checkServerVersion(context, "1.13");
+ }
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index c138b04e..430aaa3c 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -228,7 +228,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
} else if(artist && !showAll) {
menuInflater.inflate(R.menu.select_album, menu);
- if(!ServerInfo.isMadsonic(context)) {
+ if(!ServerInfo.hasTopSongs(context)) {
menu.removeItem(R.id.menu_top_tracks);
}
if(!ServerInfo.checkServerVersion(context, "1.11") || (id != null && "root".equals(id))) {
@@ -555,7 +555,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
new LoadTask(refresh) {
@Override
protected MusicDirectory load(MusicService service) throws Exception {
- return service.getTopTrackSongs(name, 20, context, this);
+ return service.getTopTrackSongs(name, 50, context, this);
}
}.execute();
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index c1eaa5cd..4597ed69 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1192,7 +1192,8 @@ public class RESTMusicService implements MusicService {
parameterNames.add("size");
parameterValues.add(size);
- Reader reader = getReader(context, progressListener, "getTopTrackSongs", null, parameterNames, parameterValues);
+ String method = ServerInfo.isMadsonic(context, getInstance(context)) ? "getTopTrackSongs" : "getTopSongs";
+ Reader reader = getReader(context, progressListener, method, null, parameterNames, parameterValues);
try {
return new RandomSongsParser(context, getInstance(context)).parse(reader, progressListener);
} finally {