*/
private static List<ScrobbleResult> convertToScrobbleResults(Result result, ScrobbleResultType scrobbleResultType) {
List<ScrobbleResult> scrobbleResults = new ArrayList<ScrobbleResult>();
if (!result.isSuccessful()) {
// if result failed then we have no extra information
ScrobbleResult scrobbleResult = new ScrobbleResult(result);
scrobbleResults.add(scrobbleResult);
} else {
DomElement element = result.getContentElement();
if (scrobbleResultType == ScrobbleResultType.NOW_PLAYING) {
ScrobbleResult scrobbleResult = new ScrobbleResult(result);
parseIntoScrobbleResult(element, scrobbleResult);
scrobbleResults.add(scrobbleResult);
} else if (scrobbleResultType == ScrobbleResultType.SINGLE_SCROBBLE) {
ScrobbleResult scrobbleResult = new ScrobbleResult(result);
parseIntoScrobbleResult(element.getChild("scrobble"), scrobbleResult);
scrobbleResults.add(scrobbleResult);
} else if (scrobbleResultType == ScrobbleResultType.MULTIPLE_SCROBBLES) {
for (DomElement scrobbleElement : element.getChildren("scrobble")) {
ScrobbleResult scrobbleResult = new ScrobbleResult(result);
parseIntoScrobbleResult(scrobbleElement, scrobbleResult);
scrobbleResults.add(scrobbleResult);
}
}
}