Flexget / Flexget

The official FlexGet repository
http://www.flexget.com
MIT License
1.74k stars 473 forks source link

from_deluge plugin KeyError with deluge 2.0 #2185

Closed Superchicken closed 6 years ago

Superchicken commented 6 years ago

Expected behaviour:

The from_deluge plugin should produce entries from the deluge client.

Actual behaviour:

KeyError, similar to #1086.

2018-07-31 20:54 CRITICAL task          remove_from_ram BUG: Unhandled error in plugin from_deluge: <class 'future.types.newlist.newlist'>
Traceback (most recent call last):
  File "/media/md5/superchicken/flexget-dev/flexget/task.py", line 486, in __run_plugin
    return method(*args, **kwargs)
  File "/media/md5/superchicken/flexget-dev/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/media/md5/superchicken/flexget-dev/flexget/plugins/clients/deluge.py", line 214, in on_task_input
    self.entries = self.generate_entries(config)
  File "/media/md5/superchicken/flexget-dev/flexget/plugins/clients/deluge.py", line 220, in generate_entries
    torrents = self.get_torrents_status(list(self.settings_map.keys()) + config.get('keys', []))
  File "/media/md5/superchicken/flexget-dev/flexget/plugins/clients/deluge.py", line 71, in get_torrents_status
    return self.client.call('core.get_torrents_status', filters, fields)
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/client.py", line 213, in call
    self._send_call(self.deluge_version, method, *args, **kwargs)
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/client.py", line 130, in _send_call
    req = zlib.compress(dumps(req))
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/rencode.py", line 429, in dumps
    encode_func[type(x)](x, r)
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/rencode.py", line 379, in encode_list
    encode_func[type(i)](i, r)
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/rencode.py", line 379, in encode_list
    encode_func[type(i)](i, r)
  File "/media/md5/superchicken/pip/local/lib/python2.7/site-packages/deluge_client/rencode.py", line 379, in encode_list
    encode_func[type(i)](i, r)
KeyError: <class 'future.types.newlist.newlist'>

Steps to reproduce:

Config:

config.yml

Log:

crash_report.2018.07.31.205427858564.log

Additional information:

Superchicken commented 6 years ago

After poking around in the current deluge.py I found a lovely comment:

# deluge client lib chokes on future's newlist, make sure we have a native python list here

changing

self.get_torrents_status(list(self.settings_map.keys()) + config.get('keys', []))

to

self.get_torrents_status(native(list(self.settings_map.keys())) + config.get('keys', []))

and adding

from future.utils import native

in deluge.py resolves this issue.

@gazpachoking Please add these changes to #2102