當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。