Search in sources :

Example 1 with Tag

use of org.musicbrainz.android.api.data.Tag in project musicbrainz-android by jdamcd.

the class TagLookupTest method parseTags.

private LinkedList<Tag> parseTags(String xmlFile) throws IOException {
    InputStream stream = getFileStream(xmlFile);
    assertNotNull(stream);
    LinkedList<Tag> tags = new ResponseParser().parseTagLookup(stream);
    stream.close();
    return tags;
}
Also used : ResponseParser(org.musicbrainz.android.api.webservice.ResponseParser) InputStream(java.io.InputStream) Tag(org.musicbrainz.android.api.data.Tag)

Example 2 with Tag

use of org.musicbrainz.android.api.data.Tag in project musicbrainz-android by jdamcd.

the class ReleaseGroupLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("release-group")) {
        releaseGroup.setMbid(atts.getValue("id"));
        releaseGroup.setType(atts.getValue("type"));
    } else if (localName.equals("title")) {
        buildString();
    } else if (localName.equals("first-release-date")) {
        buildString();
    } else if (localName.equals("artist")) {
        artist = new ReleaseArtist();
        artist.setMbid(atts.getValue("id"));
        inArtist = true;
    } else if (localName.equals("rating")) {
        releaseGroup.setRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    } else if (localName.equals("name")) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("relation")) {
        link = new WebLink();
        link.setType(atts.getValue("type"));
    } else if (localName.equals("target")) {
        buildString();
    }
}
Also used : ReleaseArtist(org.musicbrainz.android.api.data.ReleaseArtist) Tag(org.musicbrainz.android.api.data.Tag) WebLink(org.musicbrainz.android.api.data.WebLink)

Example 3 with Tag

use of org.musicbrainz.android.api.data.Tag in project musicbrainz-android by jdamcd.

the class TagHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("tag")) {
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    }
}
Also used : Tag(org.musicbrainz.android.api.data.Tag)

Example 4 with Tag

use of org.musicbrainz.android.api.data.Tag in project musicbrainz-android by jdamcd.

the class RecordingLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("recording")) {
        recording.setMbid(atts.getValue("id"));
    } else if (localName.equals("title")) {
        buildString();
    } else if (localName.equals("length")) {
        buildString();
    } else if (localName.equals("artist")) {
        inArtist = true;
        artist = new ReleaseArtist();
        artist.setMbid(atts.getValue("id"));
    } else if (localName.equals("name")) {
        buildString();
    } else if (localName.equals("tag-list")) {
        inTags = true;
    } else if (localName.equals("tag") && !inArtist) {
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("rating")) {
        recording.setRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    }
}
Also used : ReleaseArtist(org.musicbrainz.android.api.data.ReleaseArtist) Tag(org.musicbrainz.android.api.data.Tag)

Example 5 with Tag

use of org.musicbrainz.android.api.data.Tag in project musicbrainz-android by jdamcd.

the class ReleaseLookupHandler method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (localName.equals("release")) {
        release.setReleaseMbid(atts.getValue("id"));
    } else if (localName.equals("title")) {
        buildString();
    } else if (localName.equals("status")) {
        buildString();
    } else if (localName.equals("barcode")) {
        buildString();
    } else if (localName.equals("asin")) {
        buildString();
    } else if (localName.equals("artist")) {
        inArtist = true;
        releaseArtist = new ReleaseArtist();
        releaseArtist.setMbid(atts.getValue("id"));
    } else if (localName.equals("name")) {
        buildString();
    } else if (localName.equals("date")) {
        buildString();
    } else if (localName.equals("label")) {
        inLabel = true;
    } else if (localName.equals("release-group")) {
        inReleaseGroup = true;
        release.setReleaseGroupMbid(atts.getValue("id"));
    } else if (localName.equals("track")) {
        inTrack = true;
        track = new Track();
    } else if (localName.equals("recording")) {
        inRecording = true;
        track.setRecordingMbid(atts.getValue("id"));
    } else if (localName.equals("position")) {
        buildString();
    } else if (localName.equals("length")) {
        buildString();
    } else if (localName.equals("tag")) {
        inTag = true;
        buildString();
        tag = new Tag();
        tag.setCount(Integer.parseInt(atts.getValue("count")));
    } else if (localName.equals("rating") && inReleaseGroup) {
        release.setReleaseGroupRatingCount(Integer.parseInt(atts.getValue("votes-count")));
        buildString();
    } else if (localName.equals("relation-list")) {
        inRelationships = true;
    } else if (localName.equals("medium")) {
        inMedium = true;
    }
}
Also used : ReleaseArtist(org.musicbrainz.android.api.data.ReleaseArtist) Tag(org.musicbrainz.android.api.data.Tag) Track(org.musicbrainz.android.api.data.Track)

Aggregations

Tag (org.musicbrainz.android.api.data.Tag)8 ReleaseArtist (org.musicbrainz.android.api.data.ReleaseArtist)3 WebLink (org.musicbrainz.android.api.data.WebLink)3 InputStream (java.io.InputStream)1 HttpEntity (org.apache.http.HttpEntity)1 Track (org.musicbrainz.android.api.data.Track)1 ResponseParser (org.musicbrainz.android.api.webservice.ResponseParser)1