1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-17 14:55:07 -05:00

Added a exception catcher to the verify download function to catch corrupt/null torrent file exceptions.

This commit is contained in:
echel0n 2014-12-19 23:40:19 -08:00
parent 2e13186256
commit cac4af0ed7

View File

@ -188,15 +188,18 @@ class GenericProvider:
# primitive verification of torrents, just make sure we didn't get a text file or something # primitive verification of torrents, just make sure we didn't get a text file or something
if self.providerType == GenericProvider.TORRENT: if self.providerType == GenericProvider.TORRENT:
parser = createParser(file_name) try:
if parser: parser = createParser(file_name)
mime_type = parser._getMimeType() if parser:
try: mime_type = parser._getMimeType()
parser.stream._input.close() try:
except: parser.stream._input.close()
pass except:
if mime_type == 'application/x-bittorrent': pass
return True 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) logger.log(u"Result is not a valid torrent file", logger.WARNING)
return False return False