handle entry content only if the entry is new

This commit is contained in:
Athou
2013-05-29 16:42:45 +02:00
parent ed18bc55b7
commit 145285dd20
2 changed files with 11 additions and 4 deletions

View File

@@ -91,10 +91,8 @@ public class FeedParser {
entry.setAuthor(FeedUtils.truncate(item.getAuthor(), 128)); entry.setAuthor(FeedUtils.truncate(item.getAuthor(), 128));
FeedEntryContent content = new FeedEntryContent(); FeedEntryContent content = new FeedEntryContent();
content.setContent(FeedUtils.handleContent(getContent(item), content.setContent(getContent(item));
feed.getLink())); content.setTitle(item.getTitle());
content.setTitle(FeedUtils.truncate(FeedUtils.handleContent(
item.getTitle(), feed.getLink()), 2048));
SyndEnclosure enclosure = (SyndEnclosure) Iterables.getFirst( SyndEnclosure enclosure = (SyndEnclosure) Iterables.getFirst(
item.getEnclosures(), null); item.getEnclosures(), null);
if (enclosure != null) { if (enclosure != null) {

View File

@@ -14,8 +14,10 @@ import com.commafeed.backend.MetricsBean;
import com.commafeed.backend.dao.FeedEntryDAO; import com.commafeed.backend.dao.FeedEntryDAO;
import com.commafeed.backend.dao.FeedEntryStatusDAO; import com.commafeed.backend.dao.FeedEntryStatusDAO;
import com.commafeed.backend.dao.FeedSubscriptionDAO; import com.commafeed.backend.dao.FeedSubscriptionDAO;
import com.commafeed.backend.feeds.FeedUtils;
import com.commafeed.backend.model.Feed; import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry; import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedEntryContent;
import com.commafeed.backend.model.FeedEntryStatus; import com.commafeed.backend.model.FeedEntryStatus;
import com.commafeed.backend.model.FeedSubscription; import com.commafeed.backend.model.FeedSubscription;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -43,6 +45,13 @@ public class FeedUpdateService {
FeedEntry update = null; FeedEntry update = null;
if (foundEntry == null) { if (foundEntry == null) {
FeedEntryContent content = entry.getContent();
content.setTitle(FeedUtils.truncate(
FeedUtils.handleContent(content.getTitle(), feed.getLink()),
2048));
content.setContent(FeedUtils.handleContent(content.getContent(),
feed.getLink()));
entry.setInserted(Calendar.getInstance().getTime()); entry.setInserted(Calendar.getInstance().getTime());
entry.getFeeds().add(feed); entry.getFeeds().add(feed);