Skip to content

Preparing for no files key when magnetizing#1752

Merged
liiight merged 1 commit intoFlexget:developfrom
BackSlasher:patch-2
Mar 24, 2017
Merged

Preparing for no files key when magnetizing#1752
liiight merged 1 commit intoFlexget:developfrom
BackSlasher:patch-2

Conversation

@BackSlasher
Copy link
Copy Markdown
Contributor

Motivation for changes:

  • I had torrent adding exceptions when waiting on magnetization. Torrent was actually added, so it's not showstopping, but feature is still defective.

Detailed changes:

  • Will supply default value of [] when trying to access status['files'], which might not exist.
  • Also made line a bit more Pythonic

Addressed issues:

This is the error I had.

2017-03-24 10:23 INFO     deluge        download_tv     REDACTED was not added to deluge! [Failure instance: Traceback: <type 'exceptions.KeyError'>: u'files'\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:393:callback\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:501:_startRunCallbacks\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:588:_runCallbacks\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1184:gotResult\n--- <exception caught here> ---\n/usr/lib/python2.7/dist-packages/twisted/internet/defer.py:1128:_inlineCallbacks\n/srv/seedbox/flexget-venv/local/lib/python2.7/site-packages/flexget/plugins/clients/deluge.py:744:_wait_for_metadata\n]

TODO

Line can also be:

if ('files' in status) and len(status['files']):

I have no strong opinion in either way.

Copy link
Copy Markdown
Member

@liiight liiight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you could just do

If status.get('files'):

@BackSlasher
Copy link
Copy Markdown
Contributor Author

Sure why not

Now prepared for the fact that `status` may not contain `files` before magnetization
also a bit more Pythonic
@liiight liiight merged commit d54ed5a into Flexget:develop Mar 24, 2017
@BackSlasher BackSlasher deleted the patch-2 branch March 24, 2017 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants