diff options
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java | 2 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index ffa8e676..22e7f8e9 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -900,7 +900,7 @@ public class RESTMusicService implements MusicService { public MusicDirectory getPodcastEpisodes(String id, Context context, ProgressListener progressListener) throws Exception { Reader reader = getReader(context, progressListener, "getPodcasts", null, Arrays.asList("id"), Arrays.<Object>asList(id)); try { - return new PodcastEntryParser(context).parse(reader, progressListener); + return new PodcastEntryParser(context).parse(id, reader, progressListener); } finally { Util.close(reader); } diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java index efc36a7e..8ef667f4 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java @@ -37,26 +37,34 @@ public class PodcastEntryParser extends AbstractParser { super(context);
}
- public MusicDirectory parse(Reader reader, ProgressListener progressListener) throws Exception {
+ public MusicDirectory parse(String channel, Reader reader, ProgressListener progressListener) throws Exception {
updateProgress(progressListener, R.string.parser_reading);
init(reader);
MusicDirectory episodes = new MusicDirectory();
int eventType;
+ boolean valid = false;
do {
eventType = nextParseEvent();
if (eventType == XmlPullParser.START_TAG) {
String name = getElementName();
if ("channel".equals(name)) {
- episodes.setId(get("id"));
- episodes.setName(get("title"));
+ String id = get("id");
+ if(id.equals(channel)) {
+ episodes.setId(id);
+ episodes.setName(get("title"));
+ valid = true;
+ } else {
+ valid = false;
+ }
}
- else if ("episode".equals(name)) {
+ else if ("episode".equals(name) && valid) {
PodcastEpisode episode = new PodcastEpisode();
episode.setEpisodeId(get("id"));
episode.setId(get("streamId"));
episode.setTitle(get("title"));
- episode.setDescription(get("description"));
+ episode.setArtist(episodes.getName());
+ episode.setAlbum(get("description"));
episode.setDate(get("publishDate"));
episode.setStatus(get("status"));
episode.setCoverArt(get("coverArt"));
|