use of com.github.hakko.musiccabinet.parser.lastfm.ScrobbledTracksParser in project musiccabinet by hakko.
the class ScrobbledTracksService method updateSearchIndex.
@Override
protected void updateSearchIndex() throws ApplicationException {
short page = 0, totalPages = 0;
do {
WSResponse wsResponse = client.getLibraryTracks(page, lastFmSettingsService.getLastFmUsername());
if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
ScrobbledTracksParser parser = new ScrobbledTracksParserImpl(stringUtil.getInputStream());
totalPages = parser.getTotalPages();
trackPlayCountDao.createTrackPlayCounts(parser.getTrackPlayCounts());
setTotalOperations(totalPages);
addFinishedOperation();
}
} while (++page < totalPages);
}
Aggregations