本文整理匯總了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;
}