summaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorCj Malone <Cj-Malone@users.noreply.github.com>2016-07-25 10:05:44 +0100
committerCj Malone <Cj-Malone@users.noreply.github.com>2016-07-25 10:05:44 +0100
commit8a7029ed7830826dccefaa41fc44e418dfc52e30 (patch)
treeb5c711b6c2a9f5a67ebea88151662829add4b443 /core/src/main
parentd4d696d83a298cb31a7c33afc559814248ea0204 (diff)
downloadAntennaPod-8a7029ed7830826dccefaa41fc44e418dfc52e30.zip
Honor mrss' isDefault attribute
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java13
1 files changed, 11 insertions, 2 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 7e4e090b4..965ff691e 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
@@ -23,6 +23,7 @@ public class NSMedia extends Namespace {
private static final String SIZE = "fileSize";
private static final String MIME_TYPE = "type";
private static final String DURATION = "duration";
+ private static final String DEFAULT = "isDefault";
@Override
public SyndElement handleElementStart(String localName, HandlerState state,
@@ -30,14 +31,21 @@ public class NSMedia extends Namespace {
if (CONTENT.equals(localName)) {
String url = attributes.getValue(DOWNLOAD_URL);
String type = attributes.getValue(MIME_TYPE);
+ String defaultStr = attributes.getValue(DEFAULT);
boolean validType;
+ boolean isDefault = false;
if (SyndTypeUtils.enclosureTypeValid(type)) {
validType = true;
} else {
type = SyndTypeUtils.getValidMimeTypeFromUrl(url);
validType = type != null;
}
- if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
+
+ if (defaultStr == "true")
+ isDefault = true;
+
+ if (state.getCurrentItem() != null &&
+ (state.getCurrentItem().getMedia() == null || isDefault) &&
url != null && validType) {
long size = 0;
String sizeStr = attributes.getValue(SIZE);
@@ -71,4 +79,5 @@ public class NSMedia extends Namespace {
public void handleElementEnd(String localName, HandlerState state) {
}
-} \ No newline at end of file
+}
+