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