Browse Source

Fix qBittorrent 3.3.5

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

52
libs/qbittorrent/client.py

@ -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.
@ -155,16 +156,27 @@ class QBittorrentClient(object):
'paused', 'active', 'inactive'] 'paused', 'active', 'inactive']
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)
def get_torrent(self, infohash): def get_torrent(self, infohash):
@ -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,8 +305,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/download', data=data) return self._post('command/download', data=data)
@ -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):

Loading…
Cancel
Save