mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-06 03:18:01 -05:00
Added a exception catcher to the verify download function to catch corrupt/null torrent file exceptions.
This commit is contained in:
parent
2e13186256
commit
cac4af0ed7
@ -188,15 +188,18 @@ class GenericProvider:
|
||||
|
||||
# primitive verification of torrents, just make sure we didn't get a text file or something
|
||||
if self.providerType == GenericProvider.TORRENT:
|
||||
parser = createParser(file_name)
|
||||
if parser:
|
||||
mime_type = parser._getMimeType()
|
||||
try:
|
||||
parser.stream._input.close()
|
||||
except:
|
||||
pass
|
||||
if mime_type == 'application/x-bittorrent':
|
||||
return True
|
||||
try:
|
||||
parser = createParser(file_name)
|
||||
if parser:
|
||||
mime_type = parser._getMimeType()
|
||||
try:
|
||||
parser.stream._input.close()
|
||||
except:
|
||||
pass
|
||||
if mime_type == 'application/x-bittorrent':
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.log(u"Failed to validate torrent file: " + ex(e), logger.DEBUG)
|
||||
|
||||
logger.log(u"Result is not a valid torrent file", logger.WARNING)
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user