Browse Source

Fix qBittorrent 3.3.5

pull/6558/head
agentxan 9 years ago
committed by GitHub
parent
commit
4b36fc89ef
  1. 32
      libs/qbittorrent/client.py

32
libs/qbittorrent/client.py

@ -142,7 +142,8 @@ class QBittorrentClient(object):
Returns a list of torrents matching the supplied filters.
:param status: Current status of the torrents.
:param label: Fetch all torrents with the supplied label.
:param label: Fetch all torrents with the supplied label. qbittorrent < 3.3.5
:param category: Fetch all torrents with the supplied label. qbittorrent >= 3.3.5
:param sort: Sort torrents by.
:param reverse: Enable reverse sorting.
:param limit: Limit the number of torrents returned.
@ -156,6 +157,7 @@ class QBittorrentClient(object):
if status not in STATUS_LIST:
raise ValueError("Invalid status.")
if self.api_version < 10:
params = {
'filter': status,
'label': label,
@ -165,6 +167,16 @@ class QBittorrentClient(object):
'offset': offset
}
elif self.api_version >= 10:
params = {
'filter': status,
'category': label,
'sort': sort,
'reverse': reverse,
'limit': limit,
'offset': offset
}
return self._get('query/torrents', params=params)
def get_torrent(self, infohash):
@ -282,7 +294,8 @@ class QBittorrentClient(object):
:param link: URL Link or list of.
:param save_path: Path to download the torrent.
:param label: Label of the torrent(s).
:param label: Label of the torrent(s). qbittorrent < 3.3.5
:param category: Label of the torrent(s). qbittorrent >= 3.3.5
:return: Empty JSON data.
"""
@ -292,9 +305,13 @@ class QBittorrentClient(object):
if save_path:
data.update({'savepath': save_path})
if label:
if self.api_version < 10 and label:
data.update({'label': label})
elif self.api_version >= 10 and label:
data.update({'category': label})
return self._post('command/download', data=data)
def download_from_file(self, file_buffer,
@ -304,7 +321,8 @@ class QBittorrentClient(object):
:param file_buffer: Single file() buffer or list of.
:param save_path: Path to download the torrent.
:param label: Label of the torrent(s).
:param label: Label of the torrent(s). qbittorrent < 3.3.5
:param category: Label of the torrent(s). qbittorrent >= 3.3.5
:return: Empty JSON data.
"""
@ -320,8 +338,12 @@ class QBittorrentClient(object):
if save_path:
data.update({'savepath': save_path})
if label:
if self.api_version < 10 and label:
data.update({'label': label})
elif self.api_version >= 10 and label:
data.update({'category': label})
return self._post('command/upload', data=data, files=torrent_files)
def add_trackers(self, infohash, trackers):

Loading…
Cancel
Save