From 36f75f44e9321ffe50f9a7f5064655e9235bdd40 Mon Sep 17 00:00:00 2001 From: Noam Date: Sat, 19 Nov 2016 22:58:57 +0200 Subject: [PATCH] Changed some logging to better understand issue #2734 --- headphones/deluge.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/headphones/deluge.py b/headphones/deluge.py index 6c105054..6e7feb8b 100644 --- a/headphones/deluge.py +++ b/headphones/deluge.py @@ -135,7 +135,10 @@ def addTorrent(link, data=None, name=None): # remove '.torrent' suffix if name[-len('.torrent'):] == '.torrent': name = name[:-len('.torrent')] - logger.debug('Deluge: Sending Deluge torrent with name %s and content [%s...]' % (name, str(torrentfile)[:40])) + try: + logger.debug('Deluge: Sending Deluge torrent with name %s and content [%s...]' % (name, str(torrentfile)[:40])) + except: + logger.debug('Deluge: Sending Deluge torrent with problematic name and some content') result = {'type': 'torrent', 'name': name, 'content': torrentfile} @@ -445,6 +448,7 @@ def _add_torrent_file(result): try: # content is torrent file contents that needs to be encoded to base64 # this time let's try leaving the encoding as is + logger.debug('Deluge: There was a decoding issue, let\'s try again') post_data = json.dumps({"method": "core.add_torrent_file", "params": [result['name'] + '.torrent', b64encode(result['content']), {}], "id": 22})