Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qBittorent: Don't error when torrent queueing is disabled #4113

Merged
merged 1 commit into from
Apr 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion medusa/clients/torrent/qbittorrent_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

from __future__ import unicode_literals

import logging

from medusa import app
from medusa.clients.torrent.generic import GenericClient
from medusa.logger.adapters.style import BraceAdapter

from requests.auth import HTTPDigestAuth

log = BraceAdapter(logging.getLogger(__name__))
log.logger.addHandler(logging.NullHandler())


class QBittorrentAPI(GenericClient):
"""qBittorrent API class."""
Expand Down Expand Up @@ -105,7 +111,14 @@ def _set_torrent_priority(self, result):
data = {
'hashes': result.hash.lower(),
}
return self._request(method='post', data=data, cookies=self.session.cookies)
ok = self._request(method='post', data=data, cookies=self.session.cookies)

if self.response.status_code == 403:
log.info('{name}: Unable to set torrent priority because torrent queueing'
' is disabled in {name} settings.', {'name': self.name})
ok = True

return ok

def _set_torrent_pause(self, result):
self.url = '{host}command/{state}'.format(host=self.host,
Expand Down