本文整理汇总了Java中net.sourceforge.subsonic.domain.PodcastEpisode.setStatus方法的典型用法代码示例。如果您正苦于以下问题:Java PodcastEpisode.setStatus方法的具体用法?Java PodcastEpisode.setStatus怎么用?Java PodcastEpisode.setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.subsonic.domain.PodcastEpisode
的用法示例。
在下文中一共展示了PodcastEpisode.setStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteEpisode
import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
/**
* Deletes the Podcast episode with the given ID.
*
* @param episodeId The Podcast episode ID.
* @param logicalDelete Whether to perform a logical delete by setting the
* episode status to {@link PodcastStatus#DELETED}.
*/
public void deleteEpisode(int episodeId, boolean logicalDelete) {
PodcastEpisode episode = podcastDao.getEpisode(episodeId);
if (episode == null) {
return;
}
// Delete file.
if (episode.getPath() != null) {
File file = new File(episode.getPath());
if (file.exists()) {
file.delete();
// TODO: Delete directory if empty?
}
}
if (logicalDelete) {
episode.setStatus(PodcastStatus.DELETED);
episode.setErrorMessage(null);
podcastDao.updateEpisode(episode);
} else {
podcastDao.deleteEpisode(episodeId);
}
}
示例2: testUpdateEpisode
import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
public void testUpdateEpisode() {
int channelId = createChannel();
PodcastEpisode episode = new PodcastEpisode(null, channelId, "http://bar", null, null, null,
null, null, null, null, PodcastStatus.NEW, null);
podcastDao.createEpisode(episode);
episode = podcastDao.getEpisodes(channelId).get(0);
episode.setUrl("http://bar");
episode.setPath("c:/tmp");
episode.setTitle("Title");
episode.setDescription("Description");
episode.setPublishDate(new Date());
episode.setDuration("1:20");
episode.setBytesTotal(87628374612L);
episode.setBytesDownloaded(9086L);
episode.setStatus(PodcastStatus.DOWNLOADING);
episode.setErrorMessage("Some error");
podcastDao.updateEpisode(episode);
PodcastEpisode newEpisode = podcastDao.getEpisodes(channelId).get(0);
assertEquals("Wrong ID.", episode.getId(), newEpisode.getId());
assertEpisodeEquals(episode, newEpisode);
}