Skip to content

Commit

Permalink
support 4.4.0 (squash all the commits to make future rebasing easier)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Jan 2, 2022
1 parent 41b9e28 commit 90ccf7c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 2021.12.XX (XX dec 2021)
- Support for qBittorrent v4.4.0
- torrents/info results can now be filtered by a torrent tag with parameter tag
- Added new torrent state "Forced Metadata Downloading"

Version 2021.12.26 (11 dec 2021)
- Stop sending Origin and Referer headers (Fixes #63)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ qBittorrent Web API Client

Python client implementation for qBittorrent Web API. Supports qBittorrent v4.1.0+ (i.e. Web API v2.0+).

Currently supports up to qBittorrent [v4.3.9](https://github.com/qbittorrent/qBittorrent/releases/tag/release-4.3.9) (Web API v2.8.2) released on Oct 31, 2021.
Currently supports up to qBittorrent [v4.4.0](https://github.com/qbittorrent/qBittorrent/releases/tag/release-4.4.0) (Web API v2.8.3) released on XXX XX, 2021.

[Find the full documentation for this client on RTD.](https://qbittorrent-api.readthedocs.io/)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Introduction

Python client implementation for qBittorrent Web API.

Currently supports up to qBittorrent `v4.3.9 <https://github.com/qbittorrent/qBittorrent/releases/tag/release-4.3.9>`_ (Web API v2.8.2) released on Oct 31, 2021.
Currently supports up to qBittorrent `v4.4.0 <https://github.com/qbittorrent/qBittorrent/releases/tag/release-4.4.0>`_ (Web API v2.8.3) released on XXX XX, 2021.

The full qBittorrent Web API documentation is available on their `wiki <https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)>`_.

Expand Down
2 changes: 2 additions & 0 deletions qbittorrentapi/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class TorrentStates(Enum):
ALLOCATING = "allocating"
DOWNLOADING = "downloading"
METADATA_DOWNLOAD = "metaDL"
FORCED_METADATA_DOWNLOAD = "forcedMetaDL"
PAUSED_DOWNLOAD = "pausedDL"
QUEUED_DOWNLOAD = "queuedDL"
FORCED_DOWNLOAD = "forcedDL"
Expand All @@ -74,6 +75,7 @@ def is_downloading(self):
return self in (
TorrentStates.DOWNLOADING,
TorrentStates.METADATA_DOWNLOAD,
TorrentStates.FORCED_METADATA_DOWNLOAD,
TorrentStates.STALLED_DOWNLOAD,
TorrentStates.CHECKING_DOWNLOAD,
TorrentStates.PAUSED_DOWNLOAD,
Expand Down
25 changes: 25 additions & 0 deletions qbittorrentapi/torrents.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ def __call__(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -648,6 +649,7 @@ def __call__(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -659,6 +661,7 @@ def all(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -669,6 +672,7 @@ def all(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -680,6 +684,7 @@ def downloading(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -690,6 +695,7 @@ def downloading(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -701,6 +707,7 @@ def completed(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -711,6 +718,7 @@ def completed(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -722,6 +730,7 @@ def paused(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -732,6 +741,7 @@ def paused(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -743,6 +753,7 @@ def active(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -753,6 +764,7 @@ def active(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -764,6 +776,7 @@ def inactive(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -774,6 +787,7 @@ def inactive(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -785,6 +799,7 @@ def resumed(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -795,6 +810,7 @@ def resumed(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -806,6 +822,7 @@ def stalled(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -816,6 +833,7 @@ def stalled(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -827,6 +845,7 @@ def stalled_uploading(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -837,6 +856,7 @@ def stalled_uploading(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand All @@ -848,6 +868,7 @@ def stalled_downloading(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
return self._client.torrents_info(
Expand All @@ -858,6 +879,7 @@ def stalled_downloading(
limit=limit,
offset=offset,
torrent_hashes=torrent_hashes,
tag=tag,
**kwargs
)

Expand Down Expand Up @@ -1544,6 +1566,7 @@ def torrents_info(
limit=None,
offset=None,
torrent_hashes=None,
tag=None,
**kwargs
):
"""
Expand All @@ -1558,6 +1581,7 @@ def torrents_info(
:param limit: Limit length of list
:param offset: Start of list (if < 0, offset from end of list)
:param torrent_hashes: Filter list by hash (separate multiple hashes with a '|')
:param tag: Filter list by tag (empty string means "untagged"; no "tag" param means "any tag"; added in Web API v2.8.3)
:return: :class:`TorrentInfoList` - https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-list
"""
data = {
Expand All @@ -1568,6 +1592,7 @@ def torrents_info(
"limit": limit,
"offset": offset,
"hashes": self._list2string(torrent_hashes, "|"),
"tag": tag,
}
return self._post(_name=APINames.Torrents, _method="info", data=data, **kwargs)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"allocating",
"downloading",
"metaDL",
"forcedMetaDL",
"pausedDL",
"queuedDL",
"forcedDL",
Expand All @@ -31,6 +32,7 @@
downloading_states = (
"downloading",
"metaDL",
"forcedMetaDL",
"stalledDL",
"checkingDL",
"pausedDL",
Expand Down
12 changes: 12 additions & 0 deletions tests/test_torrents.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,18 @@ def test_torrents_info(client, api_version, orig_torrent_hash, client_func):
get_func(client, client_func)(torrent_hashes=orig_torrent_hash)


@pytest.mark.parametrize("client_func", ("torrents_info", "torrents.info"))
def test_torrents_info_tag(client, api_version, new_torrent, client_func):
if v(api_version) < v("2.8.3"):
return
tag_name = "tag_filter_name"
client.torrents_add_tags(tags=tag_name, torrent_hashes=new_torrent.hash)
torrents = get_func(client, client_func)(
torrent_hashes=new_torrent.hash, tag=tag_name
)
assert new_torrent.hash in {t.hash for t in torrents}


@pytest.mark.parametrize(
"client_func",
(("torrents_pause", "torrents_resume"), ("torrents.pause", "torrents.resume")),
Expand Down

0 comments on commit 90ccf7c

Please sign in to comment.