Search in sources :

Example 11 with SearchResult

use of com.frostwire.search.SearchResult in project frostwire by frostwire.

the class SearchFragment method setupAdapter.

private void setupAdapter() {
    if (adapter == null) {
        adapter = new SearchResultListAdapter(getActivity()) {

            @Override
            protected void searchResultClicked(SearchResult sr) {
                startTransfer(sr, getString(R.string.download_added_to_queue));
            }
        };
        LocalSearchEngine.instance().setListener(new LocalSearchEngineListener(this));
    }
    list.setAdapter(adapter);
}
Also used : SearchResultListAdapter(com.frostwire.android.gui.adapters.SearchResultListAdapter) TorrentCrawledSearchResult(com.frostwire.search.torrent.TorrentCrawledSearchResult) HttpSearchResult(com.frostwire.search.HttpSearchResult) TorrentSearchResult(com.frostwire.search.torrent.TorrentSearchResult) FileSearchResult(com.frostwire.search.FileSearchResult) AbstractTorrentSearchResult(com.frostwire.search.torrent.AbstractTorrentSearchResult) TorrentPromotionSearchResult(com.frostwire.frostclick.TorrentPromotionSearchResult) HttpSlideSearchResult(com.frostwire.android.gui.transfers.HttpSlideSearchResult) SearchResult(com.frostwire.search.SearchResult) YouTubeSearchResult(com.frostwire.search.youtube.YouTubeSearchResult)

Example 12 with SearchResult

use of com.frostwire.search.SearchResult in project frostwire by frostwire.

the class SearchResultListAdapter method onItemClicked.

@Override
protected void onItemClicked(View v) {
    SearchResult sr = (SearchResult) v.getTag();
    searchResultClicked(sr);
}
Also used : SoundcloudSearchResult(com.frostwire.search.soundcloud.SoundcloudSearchResult) YouTubePackageSearchResult(com.frostwire.search.youtube.YouTubePackageSearchResult) SearchResult(com.frostwire.search.SearchResult) TorrentSearchResult(com.frostwire.search.torrent.TorrentSearchResult) FileSearchResult(com.frostwire.search.FileSearchResult) StreamableSearchResult(com.frostwire.search.StreamableSearchResult) YouTubeCrawledStreamableSearchResult(com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult) YouTubeCrawledSearchResult(com.frostwire.search.youtube.YouTubeCrawledSearchResult)

Example 13 with SearchResult

use of com.frostwire.search.SearchResult in project frostwire by frostwire.

the class SearchResultListAdapter method filter.

public FilteredSearchResults filter(List<SearchResult> results) {
    FilteredSearchResults fsr = new FilteredSearchResults();
    ArrayList<SearchResult> mediaTypedFiltered = new ArrayList<>();
    ArrayList<SearchResult> keywordFiltered = new ArrayList<>();
    List<KeywordFilter> keywordFilters = getKeywordFiltersPipeline();
    for (SearchResult sr : results) {
        String extension = FilenameUtils.getExtension(((FileSearchResult) sr).getFilename());
        MediaType mt = MediaType.getMediaTypeForExtension(extension);
        if ("youtube".equals(extension)) {
            mt = MediaType.getVideoMediaType();
        } else if (mt != null && mt.equals(MediaType.getVideoMediaType()) && sr instanceof YouTubeCrawledSearchResult) {
            // NOTE: this excludes all non .youtube youtube search results (e.g. 3gp, webm) from appearing on results
            mt = null;
        }
        boolean passedKeywordFilter = KeywordFilter.passesFilterPipeline(sr, keywordFilters);
        if (isFileSearchResultMediaTypeMatching(sr, mt)) {
            if (keywordFilters.isEmpty() || passedKeywordFilter) {
                mediaTypedFiltered.add(sr);
                keywordFiltered.add(sr);
            }
        } else if (mt != null && passedKeywordFilter) {
            keywordFiltered.add(sr);
        }
        fsr.increment(mt, passedKeywordFilter);
    }
    fsr.filtered = mediaTypedFiltered;
    fsr.keywordFiltered = keywordFiltered;
    return fsr;
}
Also used : YouTubeCrawledSearchResult(com.frostwire.search.youtube.YouTubeCrawledSearchResult) KeywordFilter(com.frostwire.search.KeywordFilter) ArrayList(java.util.ArrayList) MediaType(com.frostwire.android.core.MediaType) SoundcloudSearchResult(com.frostwire.search.soundcloud.SoundcloudSearchResult) YouTubePackageSearchResult(com.frostwire.search.youtube.YouTubePackageSearchResult) SearchResult(com.frostwire.search.SearchResult) TorrentSearchResult(com.frostwire.search.torrent.TorrentSearchResult) FileSearchResult(com.frostwire.search.FileSearchResult) StreamableSearchResult(com.frostwire.search.StreamableSearchResult) YouTubeCrawledStreamableSearchResult(com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult) YouTubeCrawledSearchResult(com.frostwire.search.youtube.YouTubeCrawledSearchResult)

Example 14 with SearchResult

use of com.frostwire.search.SearchResult in project frostwire by frostwire.

the class YouTubeDownloadDialog method filterVideoOnly.

private List<SearchResult> filterVideoOnly(List<SearchResult> listData) {
    List<SearchResult> result = new ArrayList<>();
    for (SearchResult sr : listData) {
        String format = extractFormat(sr.getDisplayName());
        if (format.startsWith("AAC") || format.startsWith("MP3") || format.startsWith("H263 MP3")) {
            continue;
        }
        result.add(sr);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) YouTubePackageSearchResult(com.frostwire.search.youtube.YouTubePackageSearchResult) SearchResult(com.frostwire.search.SearchResult) YouTubeCrawledStreamableSearchResult(com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult) YouTubeCrawledSearchResult(com.frostwire.search.youtube.YouTubeCrawledSearchResult)

Aggregations

SearchResult (com.frostwire.search.SearchResult)14 TorrentSearchResult (com.frostwire.search.torrent.TorrentSearchResult)6 FileSearchResult (com.frostwire.search.FileSearchResult)5 StreamableSearchResult (com.frostwire.search.StreamableSearchResult)4 HttpSlideSearchResult (com.frostwire.android.gui.transfers.HttpSlideSearchResult)3 TorrentPromotionSearchResult (com.frostwire.frostclick.TorrentPromotionSearchResult)3 HttpSearchResult (com.frostwire.search.HttpSearchResult)3 SoundcloudSearchResult (com.frostwire.search.soundcloud.SoundcloudSearchResult)3 AbstractTorrentSearchResult (com.frostwire.search.torrent.AbstractTorrentSearchResult)3 TorrentCrawledSearchResult (com.frostwire.search.torrent.TorrentCrawledSearchResult)3 YouTubeCrawledSearchResult (com.frostwire.search.youtube.YouTubeCrawledSearchResult)3 YouTubeCrawledStreamableSearchResult (com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult)3 YouTubePackageSearchResult (com.frostwire.search.youtube.YouTubePackageSearchResult)3 YouTubeSearchResult (com.frostwire.search.youtube.YouTubeSearchResult)3 CrawlableSearchResult (com.frostwire.search.CrawlableSearchResult)2 ArchiveorgTorrentSearchResult (com.frostwire.search.archiveorg.ArchiveorgTorrentSearchResult)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 Intent (android.content.Intent)1 MediaType (com.frostwire.android.core.MediaType)1