use of org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild in project ultrasonic by ultrasonic.
the class RESTMusicService method getPodcastEpisodes.
@Override
public MusicDirectory getPodcastEpisodes(String podcastChannelId, Context context, ProgressListener progressListener) throws Exception {
if (podcastChannelId == null) {
throw new IllegalArgumentException("Podcast channel id is null!");
}
updateProgressListener(progressListener, R.string.parser_reading);
Response<GetPodcastsResponse> response = subsonicAPIClient.getApi().getPodcasts(true, podcastChannelId).execute();
checkResponseSuccessful(response);
List<MusicDirectoryChild> podcastEntries = response.body().getPodcastChannels().get(0).getEpisodeList();
MusicDirectory musicDirectory = new MusicDirectory();
for (MusicDirectoryChild podcastEntry : podcastEntries) {
if (!"skipped".equals(podcastEntry.getStatus()) && !"error".equals(podcastEntry.getStatus())) {
MusicDirectory.Entry entry = APIMusicDirectoryConverter.toDomainEntity(podcastEntry);
entry.setTrack(null);
musicDirectory.addChild(entry);
}
}
return musicDirectory;
}
Aggregations