SearchResult

A container for ProviderResults across multiple TorrentProviders. SearchResult eagerly executes the query with each TorrentProvider in providers.

Provider requests begin executing immediately and run until all are completed or SearchResult.cancel is called. Alternatively when collecting results with torrents, providerResults, or errors cancelOnComplete can be set to true which will call cancel after the downstream flow is completed.

Functions

Link copied to clipboard
fun cancel()

Cancel pending provider requests.

Link copied to clipboard

A list of the completed ProviderResults at the current moment, size may be less than providerCount.

Link copied to clipboard
fun errors(cancelOnComplete: Boolean = false): Flow<ProviderResult.Error>

A flow of ProviderResult.Errors for any failed requests made to any of the selected TorrentProviders.

Link copied to clipboard
suspend fun hasNextResult(): Boolean

Returns true when one or more providers has results that can be retrieved with additional requests.

Link copied to clipboard

True after cancel is called, no further requests will be completed.

Link copied to clipboard

True when all providers have produced a ProviderResult.

Link copied to clipboard
suspend fun nextResult(): SearchResult?

Returns a new SearchResult that contains all torrents from the current instance and will produce ProviderResults for any providers that have additional result pages.

Link copied to clipboard

The number of TorrentProviders that were selected to handle the TorrentQuery.

Link copied to clipboard

The number of ProviderResults that may be contained in this SearchResult.

Link copied to clipboard
fun providerResults(cancelOnComplete: Boolean = false): Flow<ProviderResult>

A flow of raw ProviderResults from each TorrentProvider selected to handle the TorrentQuery

Link copied to clipboard
fun torrents(cancelOnComplete: Boolean = false): Flow<TorrentDescription>

A flow of all TorrentDescriptions from each TorrentProvider selected to handle the TorrentQuery.

Link copied to clipboard
open override fun toString(): String