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


Java SearchResult.getMediaFiles方法代码示例

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


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

示例1: forSearch

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
public MediaList forSearch(String query, int offset, int count, SearchService.IndexType indexType, String username, HttpServletRequest request) {

        SearchCriteria searchCriteria = new SearchCriteria();
        searchCriteria.setCount(count);
        searchCriteria.setOffset(offset);
        searchCriteria.setQuery(query);
        List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);

        SearchResult searchResult = searchService.search(searchCriteria, musicFolders, indexType);

        MediaList result = new MediaList();
        result.setTotal(searchResult.getTotalHits());
        result.setIndex(offset);
        result.setCount(searchResult.getMediaFiles().size());
        for (MediaFile mediaFile : searchResult.getMediaFiles()) {
            result.getMediaCollectionOrMediaMetadata().add(forMediaFile(mediaFile, username, request));
        }

        return result;
    }
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:21,代码来源:SonosHelper.java

示例2: search3

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public void search3(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);
    Integer musicFolderId = getIntParameter(request, "musicFolderId");
    List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username, musicFolderId);

    SearchResult3 searchResult = new SearchResult3();

    String query = request.getParameter("query");
    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(StringUtils.trimToEmpty(query));
    criteria.setCount(getIntParameter(request, "artistCount", 20));
    criteria.setOffset(getIntParameter(request, "artistOffset", 0));
    SearchResult result = searchService.search(criteria, musicFolders, SearchService.IndexType.ARTIST_ID3);
    for (Artist artist : result.getArtists()) {
        searchResult.getArtist().add(createJaxbArtist(new ArtistID3(), artist, username));
    }

    criteria.setCount(getIntParameter(request, "albumCount", 20));
    criteria.setOffset(getIntParameter(request, "albumOffset", 0));
    result = searchService.search(criteria, musicFolders, SearchService.IndexType.ALBUM_ID3);
    for (Album album : result.getAlbums()) {
        searchResult.getAlbum().add(createJaxbAlbum(new AlbumID3(), album, username));
    }

    criteria.setCount(getIntParameter(request, "songCount", 20));
    criteria.setOffset(getIntParameter(request, "songOffset", 0));
    result = searchService.search(criteria, musicFolders, SearchService.IndexType.SONG);
    for (MediaFile song : result.getMediaFiles()) {
        searchResult.getSong().add(createJaxbChild(player, song, username));
    }

    Response res = createResponse();
    res.setSearchResult3(searchResult);
    jaxbWriter.writeResponse(request, response, res);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:39,代码来源:RESTController.java

示例3: search

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
private List<MediaFile> search(String query, String username) throws IOException {
    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(query);
    criteria.setOffset(0);
    criteria.setCount(50);
    List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);

    SearchResult result = searchService.search(criteria, musicFolders, SearchService.IndexType.SONG);
    return result.getMediaFiles();
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:11,代码来源:WapController.java

示例4: search3

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
public void search3(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    XMLBuilder builder = createXMLBuilder(request, response, true);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);
    int userGroupId = securityService.getCurrentUserGroupId(request);
    
    builder.add("searchResult3", false);

    String query = request.getParameter("query");
    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(StringUtils.trimToEmpty(query));
    criteria.setCount(getIntParameter(request, "artistCount", 20));
    criteria.setOffset(getIntParameter(request, "artistOffset", 0));
    SearchResult searchResult = searchService.search(criteria, SearchService.IndexType.ARTIST_ID3, userGroupId);
    for (Artist artist : searchResult.getArtists()) {
        builder.add("artist", createAttributesForArtist(artist, username), true);
    }

    criteria.setCount(getIntParameter(request, "albumCount", 20));
    criteria.setOffset(getIntParameter(request, "albumOffset", 0));
    searchResult = searchService.search(criteria, SearchService.IndexType.ALBUM_ID3, userGroupId);
    for (Album album : searchResult.getAlbums()) {
        builder.add("album", createAttributesForAlbum(album, username), true);
    }

    criteria.setCount(getIntParameter(request, "songCount", 20));
    criteria.setOffset(getIntParameter(request, "songOffset", 0));
    searchResult = searchService.search(criteria, SearchService.IndexType.SONG, userGroupId);
    for (MediaFile song : searchResult.getMediaFiles()) {
        builder.add("song", createAttributesForMediaFile(player, song, username), true);
    }

    builder.endAll();
    response.getWriter().print(builder);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:37,代码来源:RESTController.java

示例5: search

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
private List<MediaFile> search(String query) throws IOException {
    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(query);
    criteria.setOffset(0);
    criteria.setCount(50);

    SearchResult result = searchService.search(criteria, SearchService.IndexType.SONG, 0); //TODO: hardcoded
    return result.getMediaFiles();
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:10,代码来源:WapController.java

示例6: search

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
@Deprecated
public void search(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);

    String any = request.getParameter("any");
    String artist = request.getParameter("artist");
    String album = request.getParameter("album");
    String title = request.getParameter("title");

    StringBuilder query = new StringBuilder();
    if (any != null) {
        query.append(any).append(" ");
    }
    if (artist != null) {
        query.append(artist).append(" ");
    }
    if (album != null) {
        query.append(album).append(" ");
    }
    if (title != null) {
        query.append(title);
    }

    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(query.toString().trim());
    criteria.setCount(getIntParameter(request, "count", 20));
    criteria.setOffset(getIntParameter(request, "offset", 0));
    List<MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);

    SearchResult result = searchService.search(criteria, musicFolders, SearchService.IndexType.SONG);
    org.subsonic.restapi.SearchResult searchResult = new org.subsonic.restapi.SearchResult();
    searchResult.setOffset(result.getOffset());
    searchResult.setTotalHits(result.getTotalHits());

    for (MediaFile mediaFile : result.getMediaFiles()) {
        searchResult.getMatch().add(createJaxbChild(player, mediaFile, username));
    }
    Response res = createResponse();
    res.setSearchResult(searchResult);
    jaxbWriter.writeResponse(request, response, res);
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:44,代码来源:RESTController.java

示例7: search

import net.sourceforge.subsonic.domain.SearchResult; //导入方法依赖的package包/类
@Deprecated
public void search(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);
    XMLBuilder builder = createXMLBuilder(request, response, true);
    Player player = playerService.getPlayer(request, response);
    String username = securityService.getCurrentUsername(request);
    int userGroupId = securityService.getCurrentUserGroupId(request);

    String any = request.getParameter("any");
    String artist = request.getParameter("artist");
    String album = request.getParameter("album");
    String title = request.getParameter("title");

    StringBuilder query = new StringBuilder();
    if (any != null) {
        query.append(any).append(" ");
    }
    if (artist != null) {
        query.append(artist).append(" ");
    }
    if (album != null) {
        query.append(album).append(" ");
    }
    if (title != null) {
        query.append(title);
    }

    SearchCriteria criteria = new SearchCriteria();
    criteria.setQuery(query.toString().trim());
    criteria.setCount(getIntParameter(request, "count", 20));
    criteria.setOffset(getIntParameter(request, "offset", 0));

    SearchResult result = searchService.search(criteria, SearchService.IndexType.SONG, userGroupId);
    builder.add("searchResult", false,
            new Attribute("offset", result.getOffset()),
            new Attribute("totalHits", result.getTotalHits()));

    for (MediaFile mediaFile : result.getMediaFiles()) {
        AttributeSet attributes = createAttributesForMediaFile(player, mediaFile, username);
        builder.add("match", attributes, true);
    }
    builder.endAll();
    response.getWriter().print(builder);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:45,代码来源:RESTController.java


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