nzblnk / nzb-monkey

Reference implementation of how to handle a NZBLNK-URI.
https://nzblnk.github.io/nzb-monkey/
MIT License
77 stars 30 forks source link

Don't error out when a provider sends bad data or fails #32

Closed kwaaak closed 3 years ago

kwaaak commented 4 years ago
 - Searching NZB - Search for best NZB enabled
   with BinSearch ... NOT FOUND
   with BinSearch - Alternative Server ... DONE
Traceback (most recent call last):
  File "./nzbmonkey.py", line 1751, in <module>
    sys.exit(main())
  File "./nzbmonkey.py", line 1506, in main
    debug)
  File "./nzbmonkey.py", line 828, in search_nzb
    search_defs[engine]['skip_segment_debug'])
  File "./nzbmonkey.py", line 291, in __init__
    self.parse()
  File "./nzbmonkey.py", line 348, in parse
    for event, elem in context:
  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1227, in iterator
    root = pullparser._close_and_return_root()
  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1274, in _close_and_return_root
    root = self._parser.close()
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Pretty dirty patch, but works. This is how it looks with the patched file:

 - Searching NZB - Search for best NZB enabled
   with BinSearch ... NOT FOUND
   with BinSearch - Alternative Server ... DONE
   - Check NZB (Max. 2 missing files - Max. 2.0% missing Segments)
     Check file count ... Skip - No information found
     Check segments ...
     Overall result: Skip - No information found
   with NZBKing ... DONE
   - Check NZB (Max. 2 missing files - Max. 2.0% missing Segments)
     Check file count ... Skip - No information found
     Check segments ...
     Overall result: OK - File count is unknown - Segment check is OK
   with NZBIndex ... Timeout
   with Newzleech ... Timeout

   use NZB from NZBKing
     Upload age:      110 days
 - Pushing to NZBGET ... OK
 - Done