mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 13:56:47 +00:00
Have the TorrentInfo object raise an exception if unable to open/bdecode
the torrent file Catch the exception in AddTorrentDialog
This commit is contained in:
parent
35671b3f8e
commit
d25ad68521
@ -44,6 +44,7 @@ class TorrentInfo(object):
|
|||||||
self.__m_metadata = bencode.bdecode(open(filename, "rb").read())
|
self.__m_metadata = bencode.bdecode(open(filename, "rb").read())
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.warning("Unable to open %s: %s", filename, e)
|
log.warning("Unable to open %s: %s", filename, e)
|
||||||
|
raise e
|
||||||
|
|
||||||
self.__m_info_hash = sha(bencode.bencode(self.__m_metadata["info"])).hexdigest()
|
self.__m_info_hash = sha(bencode.bencode(self.__m_metadata["info"])).hexdigest()
|
||||||
|
|
||||||
|
@ -185,7 +185,11 @@ class AddTorrentDialog(component.Component):
|
|||||||
|
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
# Get the torrent data from the torrent file
|
# Get the torrent data from the torrent file
|
||||||
|
try:
|
||||||
info = deluge.ui.common.TorrentInfo(filename)
|
info = deluge.ui.common.TorrentInfo(filename)
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("Unable to open torrent file: %s", e)
|
||||||
|
continue
|
||||||
|
|
||||||
name = "%s (%s)" % (info.name, os.path.split(filename)[-1])
|
name = "%s (%s)" % (info.name, os.path.split(filename)[-1])
|
||||||
new_row = self.torrent_liststore.append(
|
new_row = self.torrent_liststore.append(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user