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));
FeedEntryContent content = new FeedEntryContent();
content.setContent(FeedUtils.handleContent(getContent(item),
feed.getLink()));
content.setTitle(FeedUtils.truncate(FeedUtils.handleContent(
item.getTitle(), feed.getLink()), 2048));
content.setContent(getContent(item));
content.setTitle(item.getTitle());
SyndEnclosure enclosure = (SyndEnclosure) Iterables.getFirst(
item.getEnclosures(), 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.FeedEntryStatusDAO;
import com.commafeed.backend.dao.FeedSubscriptionDAO;
import com.commafeed.backend.feeds.FeedUtils;
import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedEntryContent;
import com.commafeed.backend.model.FeedEntryStatus;
import com.commafeed.backend.model.FeedSubscription;
import com.google.common.collect.Lists;
@@ -43,6 +45,13 @@ public class FeedUpdateService {
FeedEntry update = 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.getFeeds().add(feed);