本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
}
}
}
示例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);
}