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


Java PlayQueue.isRepeatEnabled方法代码示例

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


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

示例1: convert

import net.sourceforge.subsonic.domain.PlayQueue; //导入方法依赖的package包/类
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean sendM3U, int offset) throws Exception {
    String url = request.getRequestURL().toString();

    if (sendM3U && player.isJukebox()) {
        jukeboxService.updateJukebox(player, offset);
    }
    boolean isCurrentPlayer = player.getIpAddress() != null && player.getIpAddress().equals(request.getRemoteAddr());

    boolean m3uSupported = player.isExternal() || player.isExternalWithPlaylist();
    sendM3U = player.isAutoControlEnabled() && m3uSupported && isCurrentPlayer && sendM3U;
    Locale locale = RequestContextUtils.getLocale(request);

    List<PlayQueueInfo.Entry> entries = new ArrayList<PlayQueueInfo.Entry>();
    PlayQueue playQueue = player.getPlayQueue();
    for (MediaFile file : playQueue.getFiles()) {
        String albumUrl = url.replaceFirst("/dwr/.*", "/main.view?id=" + file.getId());
        String streamUrl = url.replaceFirst("/dwr/.*", "/stream?player=" + player.getId() + "&id=" + file.getId());

        // Rewrite URLs in case we're behind a proxy.
        if (settingsService.isRewriteUrlEnabled()) {
            String referer = request.getHeader("referer");
            albumUrl = StringUtil.rewriteUrl(albumUrl, referer);
            streamUrl = StringUtil.rewriteUrl(streamUrl, referer);
        }

        String format = formatFormat(player, file);
        String username = securityService.getCurrentUsername(request);
        boolean starred = mediaFileService.getMediaFileStarredDate(file.getId(), username) != null;
        entries.add(new PlayQueueInfo.Entry(file.getId(), file.getTrackNumber(), file.getTitle(), file.getArtist(),
                file.getAlbumName(), file.getGenre(), file.getMood(), file.getYear(), formatBitRate(file),
                file.getDurationSeconds(), file.getDurationString(), format, formatContentType(format),
                formatFileSize(file.getFileSize(), locale), starred, albumUrl, streamUrl));
    }
    boolean isStopEnabled = playQueue.getStatus() == PlayQueue.Status.PLAYING && !player.isExternalWithPlaylist();
    float gain = jukeboxService.getGain();
    return new PlayQueueInfo(entries, playQueue.getIndex(), isStopEnabled, playQueue.isRepeatEnabled(), playQueue.isPandoraEnabled(), sendM3U, gain);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:38,代码来源:PlayQueueService.java

示例2: convert

import net.sourceforge.subsonic.domain.PlayQueue; //导入方法依赖的package包/类
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist, int offset) throws Exception {
    String url = request.getRequestURL().toString();

    if (serverSidePlaylist && player.isJukebox()) {
        jukeboxService.updateJukebox(player, offset);
    }
    boolean isCurrentPlayer = player.getIpAddress() != null && player.getIpAddress().equals(request.getRemoteAddr());

    boolean m3uSupported = player.isExternal() || player.isExternalWithPlaylist();
    serverSidePlaylist = player.isAutoControlEnabled() && m3uSupported && isCurrentPlayer && serverSidePlaylist;
    Locale locale = RequestContextUtils.getLocale(request);

    List<PlayQueueInfo.Entry> entries = new ArrayList<PlayQueueInfo.Entry>();
    PlayQueue playQueue = player.getPlayQueue();

    for (MediaFile file : playQueue.getFiles()) {

        String albumUrl = url.replaceFirst("/dwr/.*", "/main.view?id=" + file.getId());
        String streamUrl = url.replaceFirst("/dwr/.*", "/stream?player=" + player.getId() + "&id=" + file.getId());
        String coverArtUrl = url.replaceFirst("/dwr/.*", "/coverArt.view?id=" + file.getId());

        // Rewrite URLs in case we're behind a proxy.
        if (settingsService.isRewriteUrlEnabled()) {
            String referer = request.getHeader("referer");
            albumUrl = StringUtil.rewriteUrl(albumUrl, referer);
            streamUrl = StringUtil.rewriteUrl(streamUrl, referer);
        }

        String remoteStreamUrl = settingsService.rewriteRemoteUrl(streamUrl);
        String remoteCoverArtUrl = settingsService.rewriteRemoteUrl(coverArtUrl);

        String format = formatFormat(player, file);
        String username = securityService.getCurrentUsername(request);
        boolean starred = mediaFileService.getMediaFileStarredDate(file.getId(), username) != null;
        entries.add(new PlayQueueInfo.Entry(file.getId(), file.getTrackNumber(), file.getTitle(), file.getArtist(),
                file.getAlbumName(), file.getGenre(), file.getYear(), formatBitRate(file),
                file.getDurationSeconds(), file.getDurationString(), format, formatContentType(format),
                formatFileSize(file.getFileSize(), locale), starred, albumUrl, streamUrl, remoteStreamUrl,
                coverArtUrl, remoteCoverArtUrl));
    }
    boolean isStopEnabled = playQueue.getStatus() == PlayQueue.Status.PLAYING && !player.isExternalWithPlaylist();
    float gain = jukeboxService.getGain();
    return new PlayQueueInfo(entries, isStopEnabled, playQueue.isRepeatEnabled(), serverSidePlaylist, gain);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:45,代码来源:PlayQueueService.java


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