forked from platypush/platypush
[torrent] Normalized limit
/page
parameters in torrent.search
.
This commit is contained in:
parent
ec050b2853
commit
1dd905dc66
2 changed files with 9 additions and 4 deletions
|
@ -211,8 +211,10 @@ class TorrentPlugin(Plugin):
|
||||||
def search(
|
def search(
|
||||||
self,
|
self,
|
||||||
query: str,
|
query: str,
|
||||||
providers: Optional[Union[str, Iterable[str]]] = None,
|
|
||||||
*args,
|
*args,
|
||||||
|
providers: Optional[Union[str, Iterable[str]]] = None,
|
||||||
|
limit: int = 25,
|
||||||
|
page: int = 1,
|
||||||
**filters,
|
**filters,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
|
@ -224,9 +226,10 @@ class TorrentPlugin(Plugin):
|
||||||
:param filters: Additional filters to apply to the search, depending on
|
:param filters: Additional filters to apply to the search, depending on
|
||||||
what the configured search providers support. For example,
|
what the configured search providers support. For example,
|
||||||
``category`` and ``language`` are supported by the PopcornTime.
|
``category`` and ``language`` are supported by the PopcornTime.
|
||||||
|
:param limit: Maximum number of results to return (default: 25).
|
||||||
|
:param page: Page number (default: 1).
|
||||||
:return: .. schema:: torrent.TorrentResultSchema(many=True)
|
:return: .. schema:: torrent.TorrentResultSchema(many=True)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
def worker(provider: TorrentSearchProvider):
|
def worker(provider: TorrentSearchProvider):
|
||||||
|
@ -235,7 +238,9 @@ class TorrentPlugin(Plugin):
|
||||||
provider.provider_name(),
|
provider.provider_name(),
|
||||||
query,
|
query,
|
||||||
)
|
)
|
||||||
results.extend(provider.search(query, *args, **filters))
|
results.extend(
|
||||||
|
provider.search(query, *args, limit=limit, page=page, **filters)
|
||||||
|
)
|
||||||
|
|
||||||
if providers:
|
if providers:
|
||||||
providers = [providers] if isinstance(providers, str) else providers
|
providers = [providers] if isinstance(providers, str) else providers
|
||||||
|
|
|
@ -242,7 +242,7 @@ class PopcornTimeSearchProvider(TorrentSearchProvider):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def search_movies(self, query, language=None):
|
def search_movies(self, query, language=None, **_):
|
||||||
return self._results_to_movies_response(
|
return self._results_to_movies_response(
|
||||||
self._search_torrents(query, 'movies'), language=language
|
self._search_torrents(query, 'movies'), language=language
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue