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


Java RandomSearchCriteria类代码示例

本文整理汇总了Java中net.sourceforge.subsonic.domain.RandomSearchCriteria的典型用法代码示例。如果您正苦于以下问题:Java RandomSearchCriteria类的具体用法?Java RandomSearchCriteria怎么用?Java RandomSearchCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getRandomSongs

import net.sourceforge.subsonic.domain.RandomSearchCriteria; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public void getRandomSongs(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);

    int size = getIntParameter(request, "size", 10);
    size = Math.max(0, Math.min(size, 500));
    String genre = getStringParameter(request, "genre");
    Integer fromYear = getIntParameter(request, "fromYear");
    Integer toYear = getIntParameter(request, "toYear");
    Integer musicFolderId = getIntParameter(request, "musicFolderId");
    List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username, musicFolderId);
    RandomSearchCriteria criteria = new RandomSearchCriteria(size, genre, fromYear, toYear, musicFolders);

    Songs result = new Songs();
    for (MediaFile mediaFile : searchService.getRandomSongs(criteria)) {
        result.getSong().add(createJaxbChild(player, mediaFile, username));
    }
    Response res = createResponse();
    res.setRandomSongs(result);
    jaxbWriter.writeResponse(request, response, res);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:24,代码来源:RESTController.java

示例2: handleRequestInternal

import net.sourceforge.subsonic.domain.RandomSearchCriteria; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

        int size = ServletRequestUtils.getRequiredIntParameter(request, "size");
        String genre = request.getParameter("genre");
        if (StringUtils.equalsIgnoreCase("any", genre)) {
            genre = null;
        }

        Integer fromYear = null;
        Integer toYear = null;

        String year = request.getParameter("year");
        if (!StringUtils.equalsIgnoreCase("any", year)) {
            String[] tmp = StringUtils.split(year);
            fromYear = Integer.parseInt(tmp[0]);
            toYear = Integer.parseInt(tmp[1]);
        }

        List<MusicFolder> musicFolders = getMusicFolders(request);
        Player player = playerService.getPlayer(request, response);
        PlayQueue playQueue = player.getPlayQueue();

        RandomSearchCriteria criteria = new RandomSearchCriteria(size, genre, fromYear, toYear, musicFolders);
        playQueue.addFiles(false, searchService.getRandomSongs(criteria));

        if (request.getParameter("autoRandom") != null) {
            playQueue.setRandomSearchCriteria(criteria);
        }

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("reloadFrames", reloadFrames);

        ModelAndView result = super.handleRequestInternal(request, response);
        result.addObject("model", map);
        return result;
    }
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:37,代码来源:RandomPlayQueueController.java

示例3: handleRequestInternal

import net.sourceforge.subsonic.domain.RandomSearchCriteria; //导入依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

        int size = ServletRequestUtils.getRequiredIntParameter(request, "size");
        String genre = request.getParameter("genre");
        if (StringUtils.equalsIgnoreCase("any", genre)) {
            genre = null;
        }

        Integer fromYear = null;
        Integer toYear = null;

        String year = request.getParameter("year");
        if (!StringUtils.equalsIgnoreCase("any", year)) {
            String[] tmp = StringUtils.split(year);
            fromYear = Integer.parseInt(tmp[0]);
            toYear = Integer.parseInt(tmp[1]);
        }

        Integer musicFolderId = ServletRequestUtils.getRequiredIntParameter(request, "musicFolderId");
        if (musicFolderId == -1) {
            musicFolderId = null;
        }

        Player player = playerService.getPlayer(request, response);
        PlayQueue playQueue = player.getPlayQueue();

        RandomSearchCriteria criteria = new RandomSearchCriteria(size, genre, fromYear, toYear, musicFolderId);
        playQueue.addFiles(false, searchService.getRandomSongs(criteria));

        if (request.getParameter("autoRandom") != null) {
            playQueue.setRandomSearchCriteria(criteria);
        }

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("reloadFrames", reloadFrames);

        ModelAndView result = super.handleRequestInternal(request, response);
        result.addObject("model", map);
        return result;
    }
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:41,代码来源:RandomPlayQueueController.java


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