}
public static List<ScrobbleResult> scrobble(List<ScrobbleData> scrobbleData, Session session) {
Map<String, String> params = new HashMap<String, String>();
for (int i = 0; i < scrobbleData.size(); i++) {
ScrobbleData scrobble = scrobbleData.get(i);
// required params
params.put("artist[" + i + "]", scrobble.getArtist());
params.put("track[" + i + "]", scrobble.getTrack());
params.put("timestamp[" + i + "]", String.valueOf(scrobble.getTimestamp()));
// optional params
MapUtilities.nullSafePut(params, "album[" + i + "]", scrobble.getAlbum());
MapUtilities.nullSafePut(params, "albumArtist[" + i + "]", scrobble.getAlbumArtist());
MapUtilities.nullSafePut(params, "duration[" + i + "]", scrobble.getDuration());
MapUtilities.nullSafePut(params, "mbid[" + i + "]", scrobble.getMusicBrainzId());
MapUtilities.nullSafePut(params, "trackNumber[" + i + "]", scrobble.getTrackNumber());
MapUtilities.nullSafePut(params, "streamId[" + i + "]", scrobble.getStreamId());
}
Result result = Caller.getInstance().call("track.scrobble", session, params);
return convertToScrobbleResults(result, ScrobbleResultType.MULTIPLE_SCROBBLES);
}