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 7, 2022
1 parent 41b9e28 commit f4a1be7
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 8 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env:
LATEST_PYTHON_VERSION: "3.10"
LATEST_QBT_VERSION: 4.4.0rc1
QBT_ALWAYS_TEST: 4.4.0rc1, 4.3.9, 4.3.8, 4.3.5, 4.3.4.1, 4.3.3, 4.3.2, 4.3.1, 4.3.0.1, 4.2.0
QBT_ALWAYS_TEST: 4.4.0, 4.3.9, 4.3.8, 4.3.5, 4.3.4.1, 4.3.3, 4.3.2, 4.3.1, 4.3.0.1, 4.2.0
QT_USE_DEFAULT_PAA: 4.3.9, 4.3.8, 4.3.7, 4.3.6, 4.3.5, 4.3.4.1, 4.3.3, 4.3.2, 4.3.1, 4.3.0.1, 4.2.5, 4.2.0
SUBMIT_COVERAGE_VERSIONS: 2.7, 3.10
COMPREHENSIVE_TESTS_BRANCH: comprehensive_tests
Expand All @@ -32,8 +32,8 @@ jobs:
QBT_LEGACY_INSTALL: 4.2.5, 4.2.0
strategy:
matrix:
QBT_VER: [4.4.0rc1, 4.3.9, 4.3.8, 4.3.7, 4.3.6, 4.3.5, 4.3.4.1, 4.3.3, 4.3.2, 4.3.1, 4.3.0.1, 4.2.5, 4.2.0]
# QBT_VER: [4.4.0beta3]
# QBT_VER: [4.4.0, 4.3.9, 4.3.8, 4.3.7, 4.3.6, 4.3.5, 4.3.4.1, 4.3.3, 4.3.2, 4.3.1, 4.3.0.1, 4.2.5, 4.2.0]
QBT_VER: [4.4.0]
python-version: ["3.10", "3.9", "3.8", "3.7", "3.6", "2.7", "pypy2", "pypy3", "3.11.0-alpha.2"]
# python-version: [3.9]

Expand Down Expand Up @@ -129,6 +129,7 @@ jobs:
mkdir -p "$SRC_DIR" && mkdir -p "$QBT_DIR"
cd "$SRC_DIR"
rm -rf qBittorrent
git clone https://github.com/qbittorrent/qBittorrent.git --branch release-${{ matrix.QBT_VER }} --depth 1
cd qBittorrent
export libtorrent_CFLAGS="$LIBTOR_DIR/include/" && export libtorrent_LIBS="$LIBTOR_DIR/lib/libtorrent-rasterbar.so"
Expand All @@ -149,6 +150,7 @@ jobs:
mkdir -p "$SRC_DIR" && mkdir -p "$QBT_DIR"
cd "$SRC_DIR"
rm -rf qBittorrent
git clone https://github.com/qbittorrent/qBittorrent.git --branch release-${{ matrix.QBT_VER }} --depth 1
cd qBittorrent
cmake -G "Ninja" -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$LIBTOR_DIR" -DVERBOSE_CONFIGURE=ON \
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 2022.1.27 (7 jan 2022)
- 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"
- Support per-torrent/per-category "download folder"

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: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="qbittorrent-api",
version="2021.12.26",
version="2022.1.27",
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
include_package_data=True,
install_requires=[
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from qbittorrentapi import APIConnectionError
from qbittorrentapi import Client
from qbittorrentapi.request import Request

qbt_version = "v" + os.environ["QBT_VER"]

Expand Down Expand Up @@ -40,7 +39,7 @@
"v4.3.7": "2.8.2",
"v4.3.8": "2.8.2",
"v4.3.9": "2.8.2",
"v4.4.0rc1": "2.8.3",
"v4.4.0": "2.8.4",
}

BASE_PATH = sys_path[0]
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 f4a1be7

Please sign in to comment.