Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to include trackers from torrents/info #513

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/qbittorrentapi/torrents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ def torrents_info(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
"""
Expand All @@ -1026,6 +1027,8 @@ def torrents_info(
means "any tag"; added in Web API v2.8.3)
:param private: Filter list by private flag - use None to ignore; (added in
Web API v2.11.1)
:param include_trackers: Include trackers in response; default False; (added in
Web API v2.11.4)
""" # noqa: E501
# convert filter for pre- and post-v2.11.0
if status_filter in {"stopped", "paused", "running", "resumed"}:
Expand All @@ -1047,6 +1050,9 @@ def torrents_info(
"hashes": self._list2string(torrent_hashes, "|"),
"tag": tag,
"private": None if private is None else bool(private),
"includeTrackers": (
None if include_trackers is None else bool(include_trackers)
),
}
return self._post_cast(
_name=APINames.Torrents,
Expand Down Expand Up @@ -2576,6 +2582,7 @@ def __call__(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2588,6 +2595,7 @@ def __call__(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2601,6 +2609,7 @@ def all(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2613,6 +2622,7 @@ def all(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2626,6 +2636,7 @@ def downloading(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2638,6 +2649,7 @@ def downloading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2651,6 +2663,7 @@ def seeding(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2663,6 +2676,7 @@ def seeding(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2676,6 +2690,7 @@ def completed(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2688,6 +2703,7 @@ def completed(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2701,6 +2717,7 @@ def stopped(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2713,6 +2730,7 @@ def stopped(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2728,6 +2746,7 @@ def active(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2740,6 +2759,7 @@ def active(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2753,6 +2773,7 @@ def inactive(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2765,6 +2786,7 @@ def inactive(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2778,6 +2800,7 @@ def resumed(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2790,6 +2813,7 @@ def resumed(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2803,6 +2827,7 @@ def stalled(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2815,6 +2840,7 @@ def stalled(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2828,6 +2854,7 @@ def stalled_uploading(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2840,6 +2867,7 @@ def stalled_uploading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2853,6 +2881,7 @@ def stalled_downloading(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2865,6 +2894,7 @@ def stalled_downloading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2878,6 +2908,7 @@ def checking(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2890,6 +2921,7 @@ def checking(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2903,6 +2935,7 @@ def moving(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2915,6 +2948,7 @@ def moving(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2928,6 +2962,7 @@ def errored(
torrent_hashes: str | Iterable[str] | None = None,
tag: str | None = None,
private: bool | None = None,
include_trackers: bool | None = None,
**kwargs: APIKwargsT,
) -> TorrentInfoList:
return self._client.torrents_info(
Expand All @@ -2940,6 +2975,7 @@ def errored(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand Down
Loading