Search in sources :

Example 1 with GetPodcastsResponse

use of org.moire.ultrasonic.api.subsonic.response.GetPodcastsResponse 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;
}
Also used : MusicDirectory(org.moire.ultrasonic.domain.MusicDirectory) GetPodcastsResponse(org.moire.ultrasonic.api.subsonic.response.GetPodcastsResponse) MusicDirectoryChild(org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild)

Aggregations

MusicDirectoryChild (org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild)1 GetPodcastsResponse (org.moire.ultrasonic.api.subsonic.response.GetPodcastsResponse)1 MusicDirectory (org.moire.ultrasonic.domain.MusicDirectory)1