mirror of
https://github.com/readrops/Readrops.git
synced 2025-02-10 00:40:46 +01:00
Add media:content tag parsing for the RSS format and displaying it when it's an image
This commit is contained in:
parent
3d1919c49c
commit
808d442735
47
.idea/assetWizardSettings.xml
generated
47
.idea/assetWizardSettings.xml
generated
@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="WizardSettings">
|
|
||||||
<option name="children">
|
|
||||||
<map>
|
|
||||||
<entry key="vectorWizard">
|
|
||||||
<value>
|
|
||||||
<PersistentState>
|
|
||||||
<option name="children">
|
|
||||||
<map>
|
|
||||||
<entry key="vectorAssetStep">
|
|
||||||
<value>
|
|
||||||
<PersistentState>
|
|
||||||
<option name="children">
|
|
||||||
<map>
|
|
||||||
<entry key="clipartAsset">
|
|
||||||
<value>
|
|
||||||
<PersistentState>
|
|
||||||
<option name="values">
|
|
||||||
<map>
|
|
||||||
<entry key="url" value="jar:file:/Applications/Android%20Studio.app/Contents/plugins/android/lib/android.jar!/images/material_design_icons/content/ic_add_black_24dp.xml" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</PersistentState>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="values">
|
|
||||||
<map>
|
|
||||||
<entry key="color" value="ffffff" />
|
|
||||||
<entry key="outputName" value="ic_add_white" />
|
|
||||||
<entry key="sourceFile" value="$USER_HOME$" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</PersistentState>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</PersistentState>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
6
.idea/inspectionProfiles/Project_Default.xml
generated
6
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
@ -182,7 +182,9 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
|||||||
for (Item dbItem : items) {
|
for (Item dbItem : items) {
|
||||||
if (!Boolean.valueOf(database.itemDao().guidExist(dbItem.getGuid()))) {
|
if (!Boolean.valueOf(database.itemDao().guidExist(dbItem.getGuid()))) {
|
||||||
if (dbItem.getDescription() != null) {
|
if (dbItem.getDescription() != null) {
|
||||||
dbItem.setImageLink(HtmlParser.getDescImageLink(dbItem.getDescription()));
|
if (dbItem.getImageLink() == null)
|
||||||
|
dbItem.setImageLink(HtmlParser.getDescImageLink(dbItem.getDescription()));
|
||||||
|
|
||||||
dbItem.setDescription(Jsoup.parse(dbItem.getDescription()).text());
|
dbItem.setDescription(Jsoup.parse(dbItem.getDescription()).text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,13 +139,16 @@ public class Item {
|
|||||||
newItem.setDescription(item.getDescription());
|
newItem.setDescription(item.getDescription());
|
||||||
newItem.setGuid(item.getGuid());
|
newItem.setGuid(item.getGuid());
|
||||||
newItem.setTitle(item.getTitle());
|
newItem.setTitle(item.getTitle());
|
||||||
newItem.setImageLink(item.getImageLink());
|
|
||||||
|
|
||||||
newItem.setPubDate(DateUtils.stringToDateTime(item.getPubDate(), DateUtils.RSS_DATE_FORMAT));
|
newItem.setPubDate(DateUtils.stringToDateTime(item.getPubDate(), DateUtils.RSS_DATE_FORMAT));
|
||||||
|
|
||||||
newItem.setLink(item.getLink());
|
newItem.setLink(item.getLink());
|
||||||
newItem.setFeedId(feed.getId());
|
newItem.setFeedId(feed.getId());
|
||||||
|
|
||||||
|
if (item.getMediaContent() != null && item.getMediaContent().isContentAnImage())
|
||||||
|
newItem.setImageLink(item.getMediaContent().getUrl());
|
||||||
|
|
||||||
dbItems.add(newItem);
|
dbItems.add(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,10 @@ 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)
|
||||||
|
@Namespace(prefix = "media")
|
||||||
|
private RSSMediaContent mediaContent;
|
||||||
|
|
||||||
@Element(name = "author", required = false)
|
@Element(name = "author", required = false)
|
||||||
private String author;
|
private String author;
|
||||||
|
|
||||||
@ -98,5 +102,11 @@ public class RSSItem extends AItem {
|
|||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RSSMediaContent getMediaContent() {
|
||||||
|
return mediaContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaContent(RSSMediaContent mediaContent) {
|
||||||
|
this.mediaContent = mediaContent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.readrops.readropslibrary.localfeed.rss;
|
||||||
|
|
||||||
|
import org.simpleframework.xml.Attribute;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
@Root(name = "content", strict = false)
|
||||||
|
public class RSSMediaContent {
|
||||||
|
|
||||||
|
@Attribute(required = false)
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Attribute(required = false)
|
||||||
|
private String medium;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedium() {
|
||||||
|
return medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedium(String medium) {
|
||||||
|
this.medium = medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isContentAnImage() {
|
||||||
|
return medium.equals("image");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user