@Override
  public List<Serializable> getObjects(
      MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
    List<PodcastChannel> channels = musicService.getPodcastChannels(refresh, context, listener);

    if (!Util.isOffline(context) && ServerInfo.hasNewestPodcastEpisodes(context)) {
      try {
        newestEpisodes = musicService.getNewestPodcastEpisodes(10, context, listener);

        for (MusicDirectory.Entry entry : newestEpisodes.getChildren()) {
          for (PodcastChannel channel : channels) {
            if (channel.getId().equals(entry.getParent())) {
              PodcastEpisode episode = (PodcastEpisode) entry;

              // Update with information normally done in PodcastEntryParser
              episode.setArtist(channel.getName());
              episode.setCoverArt(channel.getCoverArt());
              episode.setPath(FileUtil.getPodcastPath(context, episode));
              break;
            }
          }
        }
      } catch (Exception e) {
        Log.e(TAG, "Failed to download newest episodes", e);
        newestEpisodes = null;
      }
    } else {
      newestEpisodes = null;
    }

    List<Serializable> serializableList = new ArrayList<>();
    serializableList.addAll(channels);

    return serializableList;
  }
  @Override
  public SectionAdapter getAdapter(List<Serializable> channels) {
    if (newestEpisodes == null || newestEpisodes.getChildrenSize() == 0) {
      return new PodcastChannelAdapter(
          context, channels, hasCoverArt ? getImageLoader() : null, this, largeAlbums);
    } else {
      List<String> headers =
          Arrays.asList(PodcastChannelAdapter.EPISODE_HEADER, PodcastChannelAdapter.CHANNEL_HEADER);

      List<MusicDirectory.Entry> episodes = newestEpisodes.getChildren(false, true);
      List<Serializable> serializableEpisodes = new ArrayList<>();

      // Put 3 in current list
      while (serializableEpisodes.size() < 3 && !episodes.isEmpty()) {
        serializableEpisodes.add(episodes.remove(0));
      }

      // Put rest in extra set
      List<Serializable> extraEpisodes = new ArrayList<>();
      extraEpisodes.addAll(episodes);

      List<List<Serializable>> sections = new ArrayList<>();
      sections.add(serializableEpisodes);
      sections.add(channels);

      return new PodcastChannelAdapter(
          context,
          headers,
          sections,
          extraEpisodes,
          ServerInfo.checkServerVersion(context, "1.13") ? getImageLoader() : null,
          this,
          largeAlbums);
    }
  }