Skip to content

Commit

Permalink
fix: combine items
Browse files Browse the repository at this point in the history
  • Loading branch information
nekolr committed Feb 5, 2024
1 parent 75b7627 commit e9776fb
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void saveGroup(SaveGroup saveGroup) {
@Override
public void refreshRss(Long groupId) {
Group group = this.getById(groupId);

List<Item> items = new ArrayList<>();
List<Matcher> matchers = JSON.parseArray(group.getMatchersJson(), Matcher.class);
ConvertContext convertContext = ConvertContext.builder()
.groupId(group.getId())
Expand All @@ -142,14 +142,16 @@ public void refreshRss(Long groupId) {
SyndFeed syndFeed = FeedUtils.getFeed(rss);
List<SyndEntry> entryList = FeedUtils.getEntries(syndFeed);
if (!CollectionUtils.isEmpty(entryList)) {
List<Item> items = entryList.stream()
.map(syndEntry -> rssConvertor.convert(syndEntry, convertContext))
.filter(Objects::nonNull)
.collect(Collectors.toList());
String xml = rssConvertor.combine(items, group.getId());
rssWriter.write(xml, getGroupRssFilepath(group.getId()));
for (SyndEntry entry : entryList) {
Item item = rssConvertor.convert(entry, convertContext);
if (Objects.nonNull(item)) {
items.add(item);
}
}
}
}
String xml = rssConvertor.combine(items, group.getId());
rssWriter.write(xml, getGroupRssFilepath(group.getId()));
}

@Override
Expand Down

0 comments on commit e9776fb

Please sign in to comment.