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);
}
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);
}
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;
}
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;
}
Aggregations