public static Episode toEpisode(Cursor cursor){
  if (cursor == null || cursor.isClosed()) {
    throw new IllegalArgumentException("Cannot process null or closed cursor");
  }
  Episode episode=new Episode();
  episode.setId(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry._ID)));
  episode.setChannelGeneratedId(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.CHANNEL_GENERATED_ID)));
  episode.setGeneratedId(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.GENERATED_ID)));
  episode.setTitle(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.TITLE)));
  episode.setDescription(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.DESCRIPTION)),false);
  episode.setDescriptionHtml(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.DESCRIPTION_HTML)));
  episode.setDuration(cursor.getLong(cursor.getColumnIndex(PremoContract.EpisodeEntry.DURATION)));
  episode.setProgress(cursor.getLong(cursor.getColumnIndex(PremoContract.EpisodeEntry.PROGRESS)));
  episode.setUrl(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.URL)));
  episode.setRemoteMediaUrl(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.REMOTE_MEDIA_URL)));
  episode.setLocalMediaUrl(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.LOCAL_MEDIA_URL)));
  episode.setSize(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.SIZE)));
  episode.setDownloadedSize(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.DOWNLOADED_SIZE)));
  episode.setMimeType(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.MIME_TYPE)));
  episode.setEpisodeStatus(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.EPISODE_STATUS_ID)));
  episode.setDownloadStatus(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.DOWNLOAD_STATUS_ID)));
  episode.setManualDownload(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.MANUAL_DOWNLOAD)) == 1);
  episode.setFavorite(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.FAVORITE)) == 1);
  episode.setChannelTitle(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.CHANNEL_TITLE)));
  episode.setChannelAuthor(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.CHANNEL_AUTHOR)));
  episode.setChannelArtworkUrl(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.CHANNEL_ARTWORK_URL)));
  episode.setChannelIsSubscribed(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.CHANNEL_IS_SUBSCRIBED)) == 1);
  episode.setManuallyAdded(cursor.getInt(cursor.getColumnIndex(PremoContract.EpisodeEntry.MANUALLY_ADDED)) == 1);
  episode.setPublishedAt(LocalDateTime.parse(cursor.getString(cursor.getColumnIndex(PremoContract.EpisodeEntry.PUBLISHED_AT))));
  return episode;
}

public static Episode toEpisode ( Cursor cursor ) { if ( cursor == null || cursor . isClosed ( ) ) { throw new IllegalArgumentException ( "Cannot process null or closed cursor" ) ; } Episode episode = new Episode ( ) ; episode . setId ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . _ID ) ) ) ; episode . setChannelGeneratedId ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . CHANNEL_GENERATED_ID ) ) ) ; episode . setGeneratedId ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . GENERATED_ID ) ) ) ; episode . setTitle ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . TITLE ) ) ) ; episode . setDescription ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . DESCRIPTION ) ) , false ) ; episode . setDescriptionHtml ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . DESCRIPTION_HTML ) ) ) ; episode . setDuration ( cursor . getLong ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . DURATION ) ) ) ; episode . setProgress ( cursor . getLong ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . PROGRESS ) ) ) ; episode . setUrl ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . URL ) ) ) ; episode . setRemoteMediaUrl ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . REMOTE_MEDIA_URL ) ) ) ; episode . setLocalMediaUrl ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . LOCAL_MEDIA_URL ) ) ) ; episode . setSize ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . SIZE ) ) ) ; episode . setDownloadedSize ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . DOWNLOADED_SIZE ) ) ) ; episode . setMimeType ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . MIME_TYPE ) ) ) ; episode . setEpisodeStatus ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . EPISODE_STATUS_ID ) ) ) ; episode . setDownloadStatus ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . DOWNLOAD_STATUS_ID ) ) ) ; episode . setManualDownload ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . MANUAL_DOWNLOAD ) ) == 1 ) ; episode . setFavorite ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . FAVORITE ) ) == 1 ) ; episode . setChannelTitle ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . CHANNEL_TITLE ) ) ) ; episode . setChannelAuthor ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . CHANNEL_AUTHOR ) ) ) ; episode . setChannelArtworkUrl ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . CHANNEL_ARTWORK_URL ) ) ) ; episode . setChannelIsSubscribed ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . CHANNEL_IS_SUBSCRIBED ) ) == 1 ) ; episode . setManuallyAdded ( cursor . getInt ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . MANUALLY_ADDED ) ) == 1 ) ; episode . setPublishedAt ( LocalDateTime . parse ( cursor . getString ( cursor . getColumnIndex ( PremoContract . EpisodeEntry . PUBLISHED_AT ) ) ) ) ; return episode ; }
converts the record referenced by the cursor to an episode
