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


Java PodcastEpisode.getPath方法代码示例

本文整理汇总了Java中net.sourceforge.subsonic.domain.PodcastEpisode.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java PodcastEpisode.getPath方法的具体用法?Java PodcastEpisode.getPath怎么用?Java PodcastEpisode.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sourceforge.subsonic.domain.PodcastEpisode的用法示例。


在下文中一共展示了PodcastEpisode.getPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJaxbPodcastEpisode

import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
private org.subsonic.restapi.PodcastEpisode createJaxbPodcastEpisode(Player player, String username, PodcastEpisode episode) {
    org.subsonic.restapi.PodcastEpisode e = new org.subsonic.restapi.PodcastEpisode();

    String path = episode.getPath();
    if (path != null) {
        MediaFile mediaFile = mediaFileService.getMediaFile(path);
        e = createJaxbChild(new org.subsonic.restapi.PodcastEpisode(), player, mediaFile, username);
        e.setStreamId(String.valueOf(mediaFile.getId()));
    }

    e.setId(String.valueOf(episode.getId()));  // Overwrites the previous "id" attribute.
    e.setChannelId(String.valueOf(episode.getChannelId()));
    e.setStatus(PodcastStatus.valueOf(episode.getStatus().name()));
    e.setTitle(episode.getTitle());
    e.setDescription(episode.getDescription());
    e.setPublishDate(jaxbWriter.convertDate(episode.getPublishDate()));
    return e;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:19,代码来源:RESTController.java

示例2: 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

示例3: filterAllowed

import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
private List<PodcastEpisode> filterAllowed(List<PodcastEpisode> episodes) {
    List<PodcastEpisode> result = new ArrayList<PodcastEpisode>(episodes.size());
    for (PodcastEpisode episode : episodes) {
        if (episode.getPath() == null || securityService.isReadAllowed(new File(episode.getPath()))) {
            result.add(episode);
        }
    }
    return result;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:10,代码来源:PodcastService.java

示例4: addMediaFileIdToEpisodes

import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
private List<PodcastEpisode> addMediaFileIdToEpisodes(List<PodcastEpisode> episodes) {
    for (PodcastEpisode episode : episodes) {
        if (episode.getPath() != null) {
            MediaFile mediaFile = mediaFileService.getMediaFile(episode.getPath());
            if (mediaFile != null && mediaFile.isPresent()) {
                episode.setMediaFileId(mediaFile.getId());
            }
        }
    }
    return episodes;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:12,代码来源:PodcastService.java

示例5: addMediaFileIdToEpisodes

import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
private void addMediaFileIdToEpisodes(List<PodcastEpisode> episodes) {
    for (PodcastEpisode episode : episodes) {
        if (episode.getPath() != null) {
            MediaFile mediaFile = mediaFileService.getMediaFile(episode.getPath());
            if (mediaFile != null) {
                episode.setMediaFileId(mediaFile.getId());
            }
        }
    }
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:11,代码来源:PodcastService.java

示例6: getPodcasts

import net.sourceforge.subsonic.domain.PodcastEpisode; //导入方法依赖的package包/类
public void getPodcasts(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);
    boolean includeEpisodes = getBooleanParameter(request, "includeEpisodes", true);
    Integer channelId = getIntParameter(request, "id");

    XMLBuilder builder = createXMLBuilder(request, response, true);
    builder.add("podcasts", false);

    for (PodcastChannel channel : podcastService.getAllChannels()) {
        if (channelId == null || channelId.equals(channel.getId())) {
            AttributeSet channelAttrs = new AttributeSet();
            channelAttrs.add("id", channel.getId());
            channelAttrs.add("url", channel.getUrl());
            channelAttrs.add("status", channel.getStatus().toString().toLowerCase());
            channelAttrs.add("title", channel.getTitle());
            channelAttrs.add("description", channel.getDescription());
            channelAttrs.add("errorMessage", channel.getErrorMessage());
            builder.add("channel", channelAttrs, false);

            if (includeEpisodes) {
                List<PodcastEpisode> episodes = podcastService.getEpisodes(channel.getId(), false);
                for (PodcastEpisode episode : episodes) {
                    AttributeSet episodeAttrs = new AttributeSet();

                    String path = episode.getPath();
                    if (path != null) {
                        MediaFile mediaFile = mediaFileService.getMediaFile(path);
                        episodeAttrs.addAll(createAttributesForMediaFile(player, mediaFile, username));
                        episodeAttrs.add("streamId", mediaFile.getId());
                    }

                    episodeAttrs.add("id", episode.getId());  // Overwrites the previous "id" attribute.
                    episodeAttrs.add("status", episode.getStatus().toString().toLowerCase());
                    episodeAttrs.add("title", episode.getTitle());
                    episodeAttrs.add("description", episode.getDescription());
                    episodeAttrs.add("publishDate", episode.getPublishDate());

                    builder.add("episode", episodeAttrs, true);
                }
            }
            builder.end(); // <channel>
        }
    }
    builder.endAll();
    response.getWriter().print(builder);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:49,代码来源:RESTController.java


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