From 328dfe6faf631423f555599466fef7e2d75ae0ce Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Sat, 25 Jan 2025 12:26:17 -0500 Subject: [PATCH] Add support to include trackers from `torrents/info` --- src/qbittorrentapi/torrents.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/qbittorrentapi/torrents.py b/src/qbittorrentapi/torrents.py index 94c763742..868870863 100644 --- a/src/qbittorrentapi/torrents.py +++ b/src/qbittorrentapi/torrents.py @@ -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: """ @@ -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"}: @@ -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, @@ -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( @@ -2588,6 +2595,7 @@ def __call__( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2613,6 +2622,7 @@ def all( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2638,6 +2649,7 @@ def downloading( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2663,6 +2676,7 @@ def seeding( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2688,6 +2703,7 @@ def completed( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2713,6 +2730,7 @@ def stopped( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2740,6 +2759,7 @@ def active( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2765,6 +2786,7 @@ def inactive( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2790,6 +2813,7 @@ def resumed( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2815,6 +2840,7 @@ def stalled( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2840,6 +2867,7 @@ def stalled_uploading( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2865,6 +2894,7 @@ def stalled_downloading( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2890,6 +2921,7 @@ def checking( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2915,6 +2948,7 @@ def moving( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, ) @@ -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( @@ -2940,6 +2975,7 @@ def errored( torrent_hashes=torrent_hashes, tag=tag, private=private, + include_trackers=include_trackers, **kwargs, )