mirror of https://github.com/readrops/Readrops.git
Fixing RSS content tag parsing, there may be more than one
This commit is contained in:
parent
385dc05691
commit
518cada73f
|
@ -6,6 +6,7 @@ import com.readrops.app.utils.DateUtils;
|
||||||
import com.readrops.readropslibrary.localfeed.atom.ATOMEntry;
|
import com.readrops.readropslibrary.localfeed.atom.ATOMEntry;
|
||||||
import com.readrops.readropslibrary.localfeed.json.JSONItem;
|
import com.readrops.readropslibrary.localfeed.json.JSONItem;
|
||||||
import com.readrops.readropslibrary.localfeed.rss.RSSItem;
|
import com.readrops.readropslibrary.localfeed.rss.RSSItem;
|
||||||
|
import com.readrops.readropslibrary.localfeed.rss.RSSMediaContent;
|
||||||
|
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
||||||
|
|
||||||
|
@ -175,8 +176,15 @@ public class Item {
|
||||||
newItem.setLink(item.getLink());
|
newItem.setLink(item.getLink());
|
||||||
newItem.setFeedId(feed.getId());
|
newItem.setFeedId(feed.getId());
|
||||||
|
|
||||||
if (item.getMediaContent() != null && item.getMediaContent().isContentAnImage())
|
if (item.getMediaContents() != null && item.getMediaContents().size() > 0) {
|
||||||
newItem.setImageLink(item.getMediaContent().getUrl());
|
for (RSSMediaContent mediaContent : item.getMediaContents()) {
|
||||||
|
if (mediaContent.isContentAnImage()) {
|
||||||
|
newItem.setImageLink(mediaContent.getUrl());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
dbItems.add(newItem);
|
dbItems.add(newItem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,12 @@ package com.readrops.readropslibrary.localfeed.rss;
|
||||||
import com.readrops.readropslibrary.localfeed.AItem;
|
import com.readrops.readropslibrary.localfeed.AItem;
|
||||||
|
|
||||||
import org.simpleframework.xml.Element;
|
import org.simpleframework.xml.Element;
|
||||||
|
import org.simpleframework.xml.ElementList;
|
||||||
import org.simpleframework.xml.Namespace;
|
import org.simpleframework.xml.Namespace;
|
||||||
import org.simpleframework.xml.Root;
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Root(name = "item", strict = false)
|
@Root(name = "item", strict = false)
|
||||||
public class RSSItem extends AItem {
|
public class RSSItem extends AItem {
|
||||||
|
|
||||||
|
@ -21,9 +24,9 @@ public class RSSItem extends AItem {
|
||||||
@Element(name = "imageLink", required = false)
|
@Element(name = "imageLink", required = false)
|
||||||
private String imageLink;
|
private String imageLink;
|
||||||
|
|
||||||
@Element(name = "content", required = false)
|
@ElementList(name = "content", inline = true, required = false)
|
||||||
@Namespace(prefix = "media")
|
@Namespace(prefix = "media")
|
||||||
private RSSMediaContent mediaContent;
|
private List<RSSMediaContent> mediaContents;
|
||||||
|
|
||||||
@Element(name = "creator", required = false)
|
@Element(name = "creator", required = false)
|
||||||
@Namespace(prefix = "dc", reference = "http://purl.org/dc/elements/1.1/")
|
@Namespace(prefix = "dc", reference = "http://purl.org/dc/elements/1.1/")
|
||||||
|
@ -32,7 +35,7 @@ public class RSSItem extends AItem {
|
||||||
@Element(name = "pubDate", required = false)
|
@Element(name = "pubDate", required = false)
|
||||||
private String pubDate;
|
private String pubDate;
|
||||||
|
|
||||||
@Element(name = "encoded",required = false, data = true)
|
@Element(name = "encoded", required = false)
|
||||||
@Namespace(prefix = "content")
|
@Namespace(prefix = "content")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
@ -103,11 +106,11 @@ public class RSSItem extends AItem {
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RSSMediaContent getMediaContent() {
|
public List<RSSMediaContent> getMediaContents() {
|
||||||
return mediaContent;
|
return mediaContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaContent(RSSMediaContent mediaContent) {
|
public void setMediaContents(List<RSSMediaContent> mediaContents) {
|
||||||
this.mediaContent = mediaContent;
|
this.mediaContents = mediaContents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue