当前位置: 首页>>代码示例>>Java>>正文


Java PodcastEpisode.setStatus方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:31,代码来源:PodcastService.java

示例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);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:24,代码来源:PodcastDaoTestCase.java


注:本文中的net.sourceforge.subsonic.domain.PodcastEpisode.setStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。