use of com.github.hakko.musiccabinet.parser.lastfm.TagInfoParser in project musiccabinet by hakko.
the class TagInfoService method updateSearchIndex.
@Override
protected void updateSearchIndex() throws ApplicationException {
List<TagInfo> tagInfos = new ArrayList<>();
Set<String> tags = getTagsForUpdate();
setTotalOperations(tags.size());
for (String tag : tags) {
WSResponse wsResponse = tagInfoClient.getTagInfo(tag, lastFmSettingsService.getLang());
if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
TagInfoParser tiParser = new TagInfoParserImpl(stringUtil.getInputStream());
tagInfos.add(tiParser.getTagInfo());
}
addFinishedOperation();
}
tagInfoDao.createTagInfo(tagInfos);
}
Aggregations