From e879d562a5237db93b83121f46ca8184635dd5fa Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 11 Feb 2015 09:12:53 -0800 Subject: Fix for Madsonic claiming to be Subsonic 5.2 with only 5.0 features --- src/github/daneren2005/dsub/domain/ServerInfo.java | 11 +++++++++++ .../daneren2005/dsub/fragments/SelectDirectoryFragment.java | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/domain/ServerInfo.java b/src/github/daneren2005/dsub/domain/ServerInfo.java index 9e1333da..a0ce23e1 100644 --- a/src/github/daneren2005/dsub/domain/ServerInfo.java +++ b/src/github/daneren2005/dsub/domain/ServerInfo.java @@ -187,6 +187,17 @@ public class ServerInfo implements Serializable { private static String getCacheName(Context context, int instance) { return "server-" + Util.getRestUrl(context, null, instance, false).hashCode() + ".ser"; } + + public static boolean hasArtistInfo(Context context) { + if(isStockSubsonic(context) && ServerInfo.checkServerVersion(context, "1.11")) { + return true; + } else if(isMadsonic(context)) { + // TODO: When madsonic adds support, figure out what REST version it is added on + return false; + } else { + return false; + } + } public static boolean canBookmark(Context context) { return checkServerVersion(context, "1.9"); diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 1e6218d1..f11995f8 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -692,8 +692,12 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter } // If artist, we want to load the artist info to use later - if(artist && ServerInfo.checkServerVersion(context, "1.11") && !Util.isOffline(context)) { - artistInfo = musicService.getArtistInfo(id, refresh, context, this); + if(artist && ServerInfo.hasArtistInfo(context) && !Util.isOffline(context)) { + try { + artistInfo = musicService.getArtistInfo(id, refresh, context, this); + } catch(Exception e) { + Log.w(TAG, "Failed to get Artist Info even though it should be supported"); + } } return new Pair(dir, licenseValid); -- cgit v1.2.3