Added support for RSS 0.91/0.92
This commit is contained in:
parent
8c541fb82d
commit
38439db85d
@ -17,6 +17,7 @@ import de.danoeh.antennapod.PodcastApp;
|
||||
public class Feed extends FeedFile {
|
||||
public static final int FEEDFILETYPE_FEED = 0;
|
||||
public static final String TYPE_RSS2 = "rss";
|
||||
public static final String TYPE_RSS091 = "rss";
|
||||
public static final String TYPE_ATOM1 = "atom";
|
||||
|
||||
private String title;
|
||||
|
@ -23,7 +23,7 @@ public class SyndHandler extends DefaultHandler {
|
||||
|
||||
public SyndHandler(Feed feed, TypeGetter.Type type) {
|
||||
state = new HandlerState(feed);
|
||||
if (type == TypeGetter.Type.RSS20) {
|
||||
if (type == TypeGetter.Type.RSS20 || type == TypeGetter.Type.RSS091) {
|
||||
state.defaultNamespaces.push(new NSRSS20());
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class TypeGetter {
|
||||
private static final String TAG = "TypeGetter";
|
||||
|
||||
enum Type {
|
||||
RSS20, ATOM, INVALID
|
||||
RSS20, RSS091, ATOM, INVALID
|
||||
}
|
||||
|
||||
private static final String ATOM_ROOT = "feed";
|
||||
@ -43,13 +43,25 @@ public class TypeGetter {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Recognized type Atom");
|
||||
return Type.ATOM;
|
||||
} else if (tag.equals(RSS_ROOT)
|
||||
&& (xpp.getAttributeValue(null, "version")
|
||||
.equals("2.0"))) {
|
||||
feed.setType(Feed.TYPE_RSS2);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Recognized type RSS 2.0");
|
||||
return Type.RSS20;
|
||||
} else if (tag.equals(RSS_ROOT)) {
|
||||
String strVersion = xpp.getAttributeValue(null,
|
||||
"version");
|
||||
if (strVersion != null) {
|
||||
|
||||
if (strVersion.equals("2.0")) {
|
||||
feed.setType(Feed.TYPE_RSS2);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Recognized type RSS 2.0");
|
||||
return Type.RSS20;
|
||||
} else if (strVersion.equals("0.91")
|
||||
|| strVersion.equals("0.92")) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Recognized type RSS 0.91/0.92");
|
||||
return Type.RSS091;
|
||||
}
|
||||
}
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID);
|
||||
} else {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Type is invalid");
|
||||
|
Loading…
x
Reference in New Issue
Block a user