Skip to content

Commit

Permalink
Fix DelugeD remove torrents when ratio is reached. Fixes pymedusa#6695 (
Browse files Browse the repository at this point in the history
pymedusa#6702)

* Try to fix DelugeD remove torrents when ratio is reached. Fixes pymedusa#6695

* Fix bug, standardize logging

* Update CHANGELOG.md

* Update CHANGELOG.md
  • Loading branch information
medariox authored and Thilas committed Jun 5, 2019
1 parent 50c0b85 commit 12863f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Fixed exception in Elite-Tracker provider when no result is found ([#6680](https://github.com/pymedusa/Medusa/pull/6680))
- Fixed exception in API v2 when an incorrect API key was provided, or none was provided ([#6703](https://github.com/pymedusa/Medusa/pull/6703))
- Removed legacy log-censoring code for Newznab providers ([#6705](https://github.com/pymedusa/Medusa/pull/6705))
- Fixed DelugeD remove torrents when ratio is reached (Python 2.7) ([#6702](https://github.com/pymedusa/Medusa/pull/6702))

## 0.3.1 (2019-03-20)

Expand Down
7 changes: 3 additions & 4 deletions medusa/clients/torrent/deluge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import json
import logging
from base64 import b64encode
from builtins import str

from medusa import app
from medusa.clients.torrent.generic import GenericClient
Expand All @@ -22,7 +21,7 @@
from requests.compat import urljoin
from requests.exceptions import RequestException

from six import viewitems
from six import text_type, viewitems

log = BraceAdapter(logging.getLogger(__name__))
log.logger.addHandler(logging.NullHandler())
Expand All @@ -33,7 +32,7 @@ def read_torrent_status(torrent_data):
found_torrents = False
info_hash_to_remove = []
for torrent in viewitems(torrent_data):
info_hash = str(torrent[0])
info_hash = text_type(torrent[0])
details = torrent[1]
if not is_info_hash_in_history(info_hash):
continue
Expand Down Expand Up @@ -472,7 +471,7 @@ def remove_ratio_reached(self):
log.info('Checking Deluge torrent status.')
if self._request(method='post', data=post_data):
if self.response.json()['error']:
log.info('Error while fetching torrents status')
log.warning('Error while fetching torrents status')
return
else:
torrent_data = self.response.json()['result']
Expand Down
1 change: 1 addition & 0 deletions medusa/clients/torrent/deluged.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def remove_ratio_reached(self):
log.info('Checking DelugeD torrent status.')

if not self.connect():
log.warning('Error while fetching torrents status')
return

torrent_data = self.drpc.get_all_torrents()
Expand Down
2 changes: 1 addition & 1 deletion medusa/clients/torrent/transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def remove_ratio_reached(self):
post_data = json.dumps({'arguments': return_params, 'method': 'torrent-get'})

if not self._request(method='post', data=post_data):
log.debug('Could not connect to Transmission. Check logs')
log.warning('Error while fetching torrents status')
return

try:
Expand Down

0 comments on commit 12863f1

Please sign in to comment.