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