Skip to content

Commit

Permalink
Add support to include trackers from torrents/info (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 authored Jan 25, 2025
1 parent 1242182 commit 82d117d
Showing 1 changed file with 36 additions and 0 deletions.
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 @@ -2621,6 +2627,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 @@ -2633,6 +2640,7 @@ def __call__(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2646,6 +2654,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 @@ -2658,6 +2667,7 @@ def all(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2671,6 +2681,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 @@ -2683,6 +2694,7 @@ def downloading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2696,6 +2708,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 @@ -2708,6 +2721,7 @@ def seeding(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2721,6 +2735,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 @@ -2733,6 +2748,7 @@ def completed(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2746,6 +2762,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 @@ -2758,6 +2775,7 @@ def stopped(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2773,6 +2791,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 @@ -2785,6 +2804,7 @@ def active(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2798,6 +2818,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 @@ -2810,6 +2831,7 @@ def inactive(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2823,6 +2845,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 @@ -2835,6 +2858,7 @@ def resumed(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2848,6 +2872,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 @@ -2860,6 +2885,7 @@ def stalled(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2873,6 +2899,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 @@ -2885,6 +2912,7 @@ def stalled_uploading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2898,6 +2926,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 @@ -2910,6 +2939,7 @@ def stalled_downloading(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2923,6 +2953,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 @@ -2935,6 +2966,7 @@ def checking(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2948,6 +2980,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 @@ -2960,6 +2993,7 @@ def moving(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand All @@ -2973,6 +3007,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 @@ -2985,6 +3020,7 @@ def errored(
torrent_hashes=torrent_hashes,
tag=tag,
private=private,
include_trackers=include_trackers,
**kwargs,
)

Expand Down

0 comments on commit 82d117d

Please sign in to comment.