From baf15690204e3c3993e19aa72486c0bc80b80f52 Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Wed, 20 Jul 2016 11:34:48 +0100 Subject: [PATCH 1/3] Fixes Atom icon image Falls back to logo if it is present but icon isn't. https://github.com/AntennaPod/AntennaPod/issues/1949 --- .../core/syndication/namespace/atom/NSAtom.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java index 7b5abf053..8410c934c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java @@ -29,7 +29,8 @@ public class NSAtom extends Namespace { private static final String UPDATED = "updated"; private static final String AUTHOR = "author"; private static final String CONTENT = "content"; - private static final String IMAGE = "logo"; + private static final String IMAGE_LOGO = "logo"; + private static final String IMAGE_ICON = "icon"; private static final String SUBTITLE = "subtitle"; private static final String PUBLISHED = "published"; @@ -194,10 +195,11 @@ public class NSAtom extends Namespace { state.getCurrentItem().setPubDate(DateUtils.parse(content)); } else if (PUBLISHED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null) { state.getCurrentItem().setPubDate(DateUtils.parse(content)); - } else if (IMAGE.equals(top) && state.getFeed() != null && state.getFeed().getImage() == null) { + } else if (IMAGE_LOGO.equals(top) && state.getFeed() != null && state.getFeed().getImage() == null) { + state.getFeed().setImage(new FeedImage(state.getFeed(), content, null)); + } else if (IMAGE_ICON.equals(top) && state.getFeed() != null) { state.getFeed().setImage(new FeedImage(state.getFeed(), content, null)); } } } - } From 3bc51b7a54753e4b510f57721be0d9d1791a8c5b Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Wed, 20 Jul 2016 12:57:08 +0100 Subject: [PATCH 2/3] Support Atom Author --- .../antennapod/core/syndication/namespace/atom/NSAtom.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java index 8410c934c..52b05aa98 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java @@ -28,6 +28,7 @@ public class NSAtom extends Namespace { private static final String LINK = "link"; private static final String UPDATED = "updated"; private static final String AUTHOR = "author"; + private static final String AUTHOR_NAME = "name"; private static final String CONTENT = "content"; private static final String IMAGE_LOGO = "logo"; private static final String IMAGE_ICON = "icon"; @@ -199,6 +200,10 @@ public class NSAtom extends Namespace { state.getFeed().setImage(new FeedImage(state.getFeed(), content, null)); } else if (IMAGE_ICON.equals(top) && state.getFeed() != null) { state.getFeed().setImage(new FeedImage(state.getFeed(), content, null)); + } else if (AUTHOR.equals(second) && state.getFeed() != null) { + if (AUTHOR_NAME.equals(top)) { + state.getFeed().setAuthor(content); + } } } } From 96468f0e8588e3b4804cb7a66ae2097763b9470d Mon Sep 17 00:00:00 2001 From: Cj Malone Date: Wed, 20 Jul 2016 13:26:40 +0100 Subject: [PATCH 3/3] Add Atom lang support --- .../antennapod/core/syndication/handler/TypeGetter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java index a086d6632..ee0a71f30 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java @@ -45,6 +45,12 @@ public class TypeGetter { case ATOM_ROOT: feed.setType(Feed.TYPE_ATOM1); Log.d(TAG, "Recognized type Atom"); + + String strLang = xpp.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"); + if (strLang != null) { + feed.setLanguage(strLang); + } + return Type.ATOM; case RSS_ROOT: String strVersion = xpp.getAttributeValue(null, "version");