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 d0c218d
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 55 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
41 changes: 5 additions & 36 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,16 @@

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

qbt_version = "v" + os.environ["QBT_VER"]
from .version_map import api_version_map

api_version_map = {
"v4.1.0": "2.0",
"v4.1.1": "2.0.1",
"v4.1.2": "2.0.2",
"v4.1.3": "2.1",
"v4.1.4": "2.1.1",
"v4.1.5": "2.2",
"v4.1.6": "2.2",
"v4.1.7": "2.2",
"v4.1.8": "2.2",
"v4.1.9": "2.2.1",
"v4.1.9.1": "2.2.1",
"v4.2.0": "2.3",
"v4.2.1": "2.4",
"v4.2.2": "2.4.1",
"v4.2.3": "2.4.1",
"v4.2.4": "2.5",
"v4.2.5": "2.5.1",
"v4.3.0": "2.6",
"v4.3.0.1": "2.6",
"v4.3.1": "2.6.1",
"v4.3.2": "2.7",
"v4.3.3": "2.7",
"v4.3.4.1": "2.8.1",
"v4.3.5": "2.8.2",
"v4.3.6": "2.8.2",
"v4.3.7": "2.8.2",
"v4.3.8": "2.8.2",
"v4.3.9": "2.8.2",
"v4.4.0rc1": "2.8.3",
}
qbt_version = "v" + os.environ["QBT_VER"]

BASE_PATH = sys_path[0]
_check_limit = 10

_orig_torrent_url = (
"http://releases.ubuntu.com/21.04/ubuntu-21.04-desktop-amd64.iso.torrent"
"https://releases.ubuntu.com/21.04/ubuntu-21.04-desktop-amd64.iso.torrent"
)
_orig_torrent_hash = "64a980abe6e448226bb930ba061592e44c3781a1"

Expand All @@ -58,11 +27,11 @@
mode="rb",
) as f:
torrent1_file = f.read()
torrent1_url = "http://cdimage.ubuntu.com/kubuntu/releases/21.04/release/kubuntu-21.04-desktop-amd64.iso.torrent"
torrent1_url = "https://cdimage.ubuntu.com/kubuntu/releases/21.04/release/kubuntu-21.04-desktop-amd64.iso.torrent"
torrent1_filename = torrent1_url.split("/")[-1]
torrent1_hash = "d65d07329264aecb2d2be7a6c0e86b6613b2a600"

torrent2_url = "http://cdimage.ubuntu.com/xubuntu/releases/21.04/release/xubuntu-21.04-desktop-amd64.iso.torrent"
torrent2_url = "https://cdimage.ubuntu.com/xubuntu/releases/21.04/release/xubuntu-21.04-desktop-amd64.iso.torrent"
torrent2_filename = torrent2_url.split("/")[-1]
torrent2_hash = "80d773cbf111e906608077967683a0ffcc3a7668"

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
7 changes: 6 additions & 1 deletion tests/test_torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ def test_set_location(api_version, new_torrent, client_func):
try:
loc = path.expanduser("~/Downloads/3/")
getattr(new_torrent, client_func)(loc)
check(lambda: new_torrent.info.save_path, loc)
# qBittorrent may return trailing separators depending on version....
check(
lambda: new_torrent.info.save_path,
(loc, loc[: len(loc) - 1]),
any=True,
)
break
except AssertionError as e:
exp = e
Expand Down
Loading

0 comments on commit d0c218d

Please sign in to comment.