DobyTang / LazyLibrarian

This project isn't finished yet. Goal is to create a SickBeard, CouchPotato, Headphones-like application for ebooks. Headphones is used as a base, so there are still a lot of references to it.
730 stars 72 forks source link

unhandled exception error while searching for a book #576

Closed VarunChugh closed 7 years ago

VarunChugh commented 7 years ago

Get the following error when searching for a book:

Unhandled exception in search_nzb_book: Traceback (most recent call last): File "/usr/pbi/lazylibrarian-amd64/share/lazylibrarian/LazyLibrarian/lazylibrarian/searchnzb.py", line 89, in search_nzb_book found = processResultList(resultlist, book, "book") File "/usr/pbi/lazylibrarian-amd64/share/lazylibrarian/LazyLibrarian/lazylibrarian/searchnzb.py", line 212, in processResultList if newValueDict['nzbmode'] == "torznab": KeyError: 'nzbmode'

jackbatzner commented 7 years ago

I ran into this issue last night as well.

I have a Newznab setup but no Torznab setup.

I am no expert in Python but what I think is happening is that the value that gets returned on line 212 in searchnzb.py is empty. Thus the unhandled exception when we try to compare values.

jackbatzner commented 7 years ago

I have started working on a fix... Will submit a merge request when I am done.

philborman commented 7 years ago

Ah, found it. It's me being stupid. Not sure why we haven't hit it before though... Line 212 should say newValueDict['NZBmode'] not newValueDict['nzbmode'] as the keys are case dependant.

jackbatzner commented 7 years ago

Yup @philborman was fixing it and submitting pull request while you found it 😄

philborman commented 7 years ago

Yes, the previous version of the code wrongly used the nzbmode from the last match found, not the highest (most preferred) match. Fixed now.