From 8a7029ed7830826dccefaa41fc44e418dfc52e30 Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Mon, 25 Jul 2016 10:05:44 +0100 Subject: Honor mrss' isDefault attribute --- .../antennapod/core/syndication/namespace/NSMedia.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'core/src/main/java/de') 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 +} + -- cgit v1.2.3