summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorCj Malone <Cj-Malone@users.noreply.github.com>2016-07-25 10:37:22 +0100
committerCj Malone <Cj-Malone@users.noreply.github.com>2016-07-25 10:37:22 +0100
commit9562f1922ae3279572cd192caea988958c9ff2d4 (patch)
tree706aac1a50b147394326cc03eb07a382975841d7 /core/src
parent8a7029ed7830826dccefaa41fc44e418dfc52e30 (diff)
downloadAntennaPod-9562f1922ae3279572cd192caea988958c9ff2d4.zip
Support mrss' thumbnail
Note, this only supports one image as that's all AntennaPod can at the moment.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java
index 965ff691e..5b7f8f5c5 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java
@@ -25,6 +25,9 @@ public class NSMedia extends Namespace {
private static final String DURATION = "duration";
private static final String DEFAULT = "isDefault";
+ private static final String IMAGE = "thumbnail";
+ private static final String IMAGE_URL = "url";
+
@Override
public SyndElement handleElementStart(String localName, HandlerState state,
Attributes attributes) {
@@ -71,6 +74,22 @@ public class NSMedia extends Namespace {
}
state.getCurrentItem().setMedia(media);
}
+ } else if (IMAGE.equals(localName)) {
+ String url = attributes.getValue(IMAGE_URL);
+ if (url != null) {
+ FeedImage image = new FeedImage();
+ image.setDownload_url(url);
+
+ if (state.getCurrentItem() != null) {
+ image.setOwner(state.getCurrentItem());
+ state.getCurrentItem().setImage(image);
+ } else {
+ if (state.getFeed().getImage() == null) {
+ image.setOwner(state.getFeed());
+ state.getFeed().setImage(image);
+ }
+ }
+ }
}
return new SyndElement(localName, this);
}