nosmokingbandit / Watcher3

Other
281 stars 60 forks source link

DelugeRPC UI priorities don't match #272

Open fourbytes opened 6 years ago

fourbytes commented 6 years ago

When configuring the DelugeRPC downloader, the available priorities in the UI do not match what is acceptable by the downloader.

UI options:

downloaders/DelugeRPC.py:87

    priority_keys = {
        'Normal': 0,
        'High': 128,
        'Max': 255
    }

    ...

    options['priority'] = priority_keys[conf['priority']]

Selecting very low or low (and probably 'forced'), leads to the following 500:

Traceback (most recent call last):
  File "/app/watcher/lib/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/app/watcher/lib/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/app/watcher/lib/cherrypy/lib/jsontools.py", line 61, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File "/app/watcher/lib/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/app/watcher/core/ajax.py", line 268, in manual_download
    return snatcher.download(data)
  File "/app/watcher/core/snatcher.py", line 183, in download
    response = snatch_torrent(data)
  File "/app/watcher/core/snatcher.py", line 251, in snatch_torrent
    response = getattr(downloaders, client).add_torrent(data)
  File "/app/watcher/core/downloaders/DelugeRPC.py", line 87, in add_torrent
    options['priority'] = priority_keys[conf['priority']]
KeyError: 'Low'
nosmokingbandit commented 6 years ago

I have no idea how I managed to miss that. Too much copy/past action late at night when I'm too tired to think straight.

Should work as expected in 0640c37107c27f18413e5ae1fd3c288b7c281bb8. Options are reduced to Low, Normal, and High (same as Max). I can add more granularity if needed.