From 5ff63f80c82e7df9425aed628cbf3d19b958725f Mon Sep 17 00:00:00 2001 From: lulandco <lulandco@free.fr> Date: Mon, 28 Dec 2015 16:13:59 +0100 Subject: [PATCH] Fixes for qbittorrent api >=6 prevent a new cookie generation which made authentication failure Add warning for qbittorrent labels Add labels + warnings for qbittorrent Fix bug for session cookie rev 2 Fix authentication for other client Fix bug for labelling with qbittorrent API >= 6 API >= 6 needs hashes to be in lowercase Update qbittorrent_client.py --- gui/slick/js/core.js | 4 ++-- gui/slick/js/core.min.js | Bin 68529 -> 68614 bytes gui/slick/views/config_search.mako | 6 ++++++ sickbeard/clients/generic.py | 7 ++++--- sickbeard/clients/qbittorrent_client.py | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gui/slick/js/core.js b/gui/slick/js/core.js index 32ba8b947..e1cb8c23f 100644 --- a/gui/slick/js/core.js +++ b/gui/slick/js/core.js @@ -1626,8 +1626,8 @@ var SICKRAGE = { $('#torrent_auth_type_option').show(); } else if (selectedProvider.toLowerCase() === 'qbittorrent'){ client = 'qbittorrent'; - $('#torrent_path_option').hide(); - $('#torrent_label_option').hide(); + $('#label_warning_qbittorrent').show(); + $('#label_anime_warning_qbittorrrent').show(); $('#torrent_label_anime_option').hide(); $('#host_desc_torrent').text('URL to your qbittorrent client (e.g. http://localhost:8080)'); } else if (selectedProvider.toLowerCase() === 'mlnet'){ diff --git a/gui/slick/js/core.min.js b/gui/slick/js/core.min.js index cafbadcdf14649b20160670b8b1aeb477f850f23..a87d718c27160fbd0e288b185772a86e0e0fd332 100644 GIT binary patch delta 78 zcmdluouzFC%Z4*kCa><{p4>l^WAgneq9C?pPGVAOPJDS{QC?<VdVFD0W=TnYQBi7M W$z=b2C2nN?iXM~As#AN)7`XskjUi(I delta 22 ecmZph!Lo5W%Z4*kCV%KPo}4#HZFA++o-zP{WD7n3 diff --git a/gui/slick/views/config_search.mako b/gui/slick/views/config_search.mako index 6fce79b21..d5d87f199 100644 --- a/gui/slick/views/config_search.mako +++ b/gui/slick/views/config_search.mako @@ -565,6 +565,9 @@ <span id="label_warning_deluge" style="display:none"><p>(blank spaces are not allowed)</p> <div class="clear-left"><p>note: label plugin must be enabled in Deluge clients</p></div> </span> + <span id="label_warning_qbittorrent" style="display:none"><p>(blank spaces are not allowed)</p> + <div class="clear-left"><p>note: for QBitTorrent 3.3.1 and up</p></div> + </span> </span> </label> </div> @@ -577,6 +580,9 @@ <span id="label_anime_warning_deluge" style="display:none"><p>(blank spaces are not allowed)</p> <div class="clear-left"><p>note: label plugin must be enabled in Deluge clients</p></div> </span> + <span id="label_anime_warning_qbittorrent" style="display:none"><p>(blank spaces are not allowed)</p> + <div class="clear-left"><p>note: for QBitTorrent 3.3.1 and up </p></div> + </span> </span> </label> </div> diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index bcea0118c..40970480a 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -173,9 +173,10 @@ class GenericClient(object): logger.log(u'Calling ' + self.name + ' Client', logger.DEBUG) - if not self._get_auth(): - logger.log(self.name + u': Authentication Failed', logger.ERROR) - return r_code + if not self.auth: + if not self._get_auth(): + logger.log(self.name + u': Authentication Failed', logger.ERROR) + return r_code try: # Sets per provider seed ratio diff --git a/sickbeard/clients/qbittorrent_client.py b/sickbeard/clients/qbittorrent_client.py index a89f7ae60..d68e12f75 100644 --- a/sickbeard/clients/qbittorrent_client.py +++ b/sickbeard/clients/qbittorrent_client.py @@ -84,7 +84,7 @@ class qbittorrentAPI(GenericClient): if self.api > 6: self.url = self.host + 'command/setLabel' - data = {'hashes': result.hash, 'label': label} + data = {'hashes': result.hash.lower(), 'label': label} return self._request(method='post', data=data, cookies=self.session.cookies) return None @@ -94,7 +94,7 @@ class qbittorrentAPI(GenericClient): if result.priority == 1: self.url = self.host + 'command/increasePrio' - data = {'hashes': result.hash} + data = {'hashes': result.hash.lower()} return self._request(method='post', data=data, cookies=self.session.cookies) def _set_torrent_pause(self, result): -- GitLab