aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/domain/ArtistInfo.java9
-rw-r--r--src/github/daneren2005/dsub/service/RESTMusicService.java2
-rw-r--r--src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java16
3 files changed, 22 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/domain/ArtistInfo.java b/src/github/daneren2005/dsub/domain/ArtistInfo.java
index 325f1b6f..2205d561 100644
--- a/src/github/daneren2005/dsub/domain/ArtistInfo.java
+++ b/src/github/daneren2005/dsub/domain/ArtistInfo.java
@@ -24,6 +24,7 @@ public class ArtistInfo implements Serializable {
private String lastFMUrl;
private String imageUrl;
private List<Artist> similarArtists;
+ private List<String> missingArtists;
public String getBiography() {
return biography;
@@ -64,4 +65,12 @@ public class ArtistInfo implements Serializable {
public void setSimilarArtists(List<Artist> similarArtists) {
this.similarArtists = similarArtists;
}
+
+ public List<String> getMissingArtists() {
+ return missingArtists;
+ }
+
+ public void setMissingArtists(List<String> missingArtists) {
+ this.missingArtists = missingArtists;
+ }
}
diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java
index 084c0f52..239b2b43 100644
--- a/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -1383,7 +1383,7 @@ public class RESTMusicService implements MusicService {
public ArtistInfo getArtistInfo(String id, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
checkServerVersion(context, "1.11", "Getting artist info is not supported");
- Reader reader = getReader(context, progressListener, Util.isTagBrowsing(context, getInstance(context)) ? "getArtistInfo2" : "getArtistInfo", null, Arrays.asList("id"), Arrays.<Object>asList(id));
+ Reader reader = getReader(context, progressListener, Util.isTagBrowsing(context, getInstance(context)) ? "getArtistInfo2" : "getArtistInfo", null, Arrays.asList("id", "includeNotPresent"), Arrays.<Object>asList(id, "true"));
try {
return new ArtistInfoParser(context, getInstance(context)).parse(reader, progressListener);
} finally {
diff --git a/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java b/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
index 9ffb354c..5b8dc796 100644
--- a/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
+++ b/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
@@ -38,6 +38,7 @@ public class ArtistInfoParser extends AbstractParser {
ArtistInfo info = new ArtistInfo();
List<Artist> artists = new ArrayList<Artist>();
+ List<String> missingArtists = new ArrayList<String>();
int eventType;
do {
@@ -53,10 +54,16 @@ public class ArtistInfoParser extends AbstractParser {
} else if ("largeImageUrl".equals(name)) {
info.setImageUrl(getText());
} else if ("similarArtist".equals(name)) {
- Artist artist = new Artist();
- artist.setId(get("id"));
- artist.setName(get("name"));
- artists.add(artist);
+ String id = get("id");
+ if(id.equals("-1")) {
+ missingArtists.add(get("name"));
+ } else {
+ Artist artist = new Artist();
+ artist.setId(id);
+ artist.setName(get("name"));
+ artist.setStarred(get("starred") != null);
+ artists.add(artist);
+ }
} else if ("error".equals(name)) {
handleError();
}
@@ -64,6 +71,7 @@ public class ArtistInfoParser extends AbstractParser {
} while (eventType != XmlPullParser.END_DOCUMENT);
info.setSimilarArtists(artists);
+ info.setMissingArtists(missingArtists);
return info;
}
}