aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-01-12 14:39:52 -0800
committerScott Jackson <daneren2005@gmail.com>2015-01-12 14:39:52 -0800
commit2602d6405f53e9f3923dcb941b9f68e0df1f593a (patch)
tree9a6bd0b419afc6ce417258fc0550e2c2be0a43d8
parenteaa34272cc62237cfd3639e6a17eddd5741e8ce0 (diff)
downloaddsub-2602d6405f53e9f3923dcb941b9f68e0df1f593a.tar.gz
dsub-2602d6405f53e9f3923dcb941b9f68e0df1f593a.tar.bz2
dsub-2602d6405f53e9f3923dcb941b9f68e0df1f593a.zip
Fix bio, etc not being parsed correctly
-rw-r--r--src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java b/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
index 5b8dc796..5c3d2412 100644
--- a/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
+++ b/src/github/daneren2005/dsub/service/parser/ArtistInfoParser.java
@@ -16,6 +16,7 @@
package github.daneren2005.dsub.service.parser;
import android.content.Context;
+import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
@@ -28,6 +29,7 @@ import github.daneren2005.dsub.domain.ArtistInfo;
import github.daneren2005.dsub.util.ProgressListener;
public class ArtistInfoParser extends AbstractParser {
+ private static final String TAG = ArtistInfo.class.getSimpleName();
public ArtistInfoParser(Context context, int instance) {
super(context, instance);
@@ -40,20 +42,13 @@ public class ArtistInfoParser extends AbstractParser {
List<Artist> artists = new ArrayList<Artist>();
List<String> missingArtists = new ArrayList<String>();
+ String tagName = null;
int eventType;
do {
eventType = nextParseEvent();
if (eventType == XmlPullParser.START_TAG) {
- String name = getElementName();
- if ("biography".equals(name)) {
- info.setBiography(getText());
- } else if ("musicBrainzId".equals(name)) {
- info.setMusicBrainzId(getText());
- } else if ("lastFmUrl".equals(name)) {
- info.setLastFMUrl(getText());
- } else if ("largeImageUrl".equals(name)) {
- info.setImageUrl(getText());
- } else if ("similarArtist".equals(name)) {
+ tagName = getElementName();
+ if ("similarArtist".equals(tagName)) {
String id = get("id");
if(id.equals("-1")) {
missingArtists.add(get("name"));
@@ -64,9 +59,19 @@ public class ArtistInfoParser extends AbstractParser {
artist.setStarred(get("starred") != null);
artists.add(artist);
}
- } else if ("error".equals(name)) {
+ } else if ("error".equals(tagName)) {
handleError();
}
+ } else if(eventType == XmlPullParser.TEXT) {
+ if ("biography".equals(tagName) && info.getBiography() == null) {
+ info.setBiography(getText());
+ } else if ("musicBrainzId".equals(tagName) && info.getMusicBrainzId() == null) {
+ info.setMusicBrainzId(getText());
+ } else if ("lastFmUrl".equals(tagName) && info.getLastFMUrl() == null) {
+ info.setLastFMUrl(getText());
+ } else if ("largeImageUrl".equals(tagName) && info.getImageUrl() == null) {
+ info.setImageUrl(getText());
+ }
}
} while (eventType != XmlPullParser.END_DOCUMENT);