Minor changes
This commit is contained in:
parent
1c57e36dcb
commit
7199daf81a
@ -1,8 +1,7 @@
|
||||
package de.danoeh.antennapod.core.syndication.handler;
|
||||
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.core.BuildConfig;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
|
||||
import org.apache.commons.io.input.XmlStreamReader;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
@ -14,6 +13,8 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
|
||||
/** Gets the type of a specific feed by reading the root element. */
|
||||
public class TypeGetter {
|
||||
private static final String TAG = "TypeGetter";
|
||||
@ -42,38 +43,30 @@ public class TypeGetter {
|
||||
String tag = xpp.getName();
|
||||
if (tag.equals(ATOM_ROOT)) {
|
||||
feed.setType(Feed.TYPE_ATOM1);
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Recognized type Atom");
|
||||
Log.d(TAG, "Recognized type Atom");
|
||||
return Type.ATOM;
|
||||
} else if (tag.equals(RSS_ROOT)) {
|
||||
String strVersion = xpp.getAttributeValue(null,
|
||||
"version");
|
||||
String strVersion = xpp.getAttributeValue(null, "version");
|
||||
if (strVersion != null) {
|
||||
|
||||
if (strVersion.equals("2.0")) {
|
||||
feed.setType(Feed.TYPE_RSS2);
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Recognized type RSS 2.0");
|
||||
Log.d(TAG, "Recognized type RSS 2.0");
|
||||
return Type.RSS20;
|
||||
} else if (strVersion.equals("0.91")
|
||||
|| strVersion.equals("0.92")) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Recognized type RSS 0.91/0.92");
|
||||
Log.d(TAG, "Recognized type RSS 0.91/0.92");
|
||||
return Type.RSS091;
|
||||
}
|
||||
}
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID);
|
||||
} else {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Type is invalid");
|
||||
Log.d(TAG, "Type is invalid");
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID, tag);
|
||||
}
|
||||
} else {
|
||||
eventType = xpp.next();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (XmlPullParserException e) {
|
||||
e.printStackTrace();
|
||||
// XML document might actually be a HTML document -> try to parse as HTML
|
||||
@ -100,8 +93,7 @@ public class TypeGetter {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Type is invalid");
|
||||
Log.d(TAG, "Type is invalid");
|
||||
throw new UnsupportedFeedtypeException(Type.INVALID);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user