diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-01-04 13:23:50 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-01-04 13:23:50 -0800 |
commit | 323d1d98f373d3cb15f829675333c4dfec61bf2e (patch) | |
tree | 5b8874bc60910e3c08cd485d36911324936b9633 /src | |
parent | 6a62b5d859c202f48ceff89612538702210e2b9a (diff) | |
download | dsub-323d1d98f373d3cb15f829675333c4dfec61bf2e.tar.gz dsub-323d1d98f373d3cb15f829675333c4dfec61bf2e.tar.bz2 dsub-323d1d98f373d3cb15f829675333c4dfec61bf2e.zip |
#438Added missing artists, starts to data pulled
Diffstat (limited to 'src')
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; } } |