use of com.frostwire.search.torrent.TorrentCrawledSearchResult in project frostwire by frostwire.
the class TransferManager method createBittorrentDownload.
private static BittorrentDownload createBittorrentDownload(TransferManager manager, TorrentSearchResult sr) {
if (sr instanceof TorrentCrawledSearchResult) {
TorrentCrawledSearchResult torrentCrawledSearchResult = (TorrentCrawledSearchResult) sr;
BTEngine.getInstance().download(torrentCrawledSearchResult, null, manager.isDeleteStartedTorrentEnabled());
} else if (sr.getTorrentUrl() != null) {
return new TorrentFetcherDownload(manager, new TorrentSearchResultInfo(sr));
}
return null;
}
use of com.frostwire.search.torrent.TorrentCrawledSearchResult in project frostwire by frostwire.
the class PerformersHelper method crawlTorrent.
/**
* This method is only public allow reuse inside the package search, consider it a private API
*/
public static List<? extends SearchResult> crawlTorrent(SearchPerformer performer, TorrentCrawlableSearchResult sr, byte[] data, boolean detectAlbums) {
List<TorrentCrawledSearchResult> list = new LinkedList<>();
if (data == null) {
return list;
}
TorrentInfo ti;
try {
ti = TorrentInfo.bdecode(data);
} catch (Throwable t) {
// LOG.error("Can't bdecode:\n" + new String(data) + "\n\n");
throw t;
}
int numFiles = ti.numFiles();
FileStorage fs = ti.files();
for (int i = 0; !performer.isStopped() && i < numFiles; i++) {
// TODO: Check for the hidden attribute
if (fs.padFileAt(i)) {
continue;
}
list.add(new TorrentCrawledSearchResult(sr, ti, i, fs.filePath(i), fs.fileSize(i)));
}
if (detectAlbums) {
List<SearchResult> temp = new LinkedList<>();
temp.addAll(list);
temp.addAll(new AlbumCluster().detect(sr, list));
return temp;
} else {
return list;
}
}
use of com.frostwire.search.torrent.TorrentCrawledSearchResult in project frostwire by frostwire.
the class TorrentUISearchResult method download.
@Override
public void download(boolean partial) {
GUIMediator gm = GUIMediator.instance();
gm.openTorrentSearchResult(sr, partial);
showDetails(false);
UXStats.instance().log((sr instanceof TorrentCrawledSearchResult) ? UXAction.DOWNLOAD_PARTIAL_TORRENT_FILE : UXAction.DOWNLOAD_FULL_TORRENT_FILE);
}
Aggregations