mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 23:48:40 +00:00
[AutoAdd] Handle AddTorrentError exceptions
This commit is contained in:
parent
c8d084c563
commit
9aed7a7f0c
1 changed files with 13 additions and 7 deletions
|
@ -28,6 +28,7 @@ import deluge.configmanager
|
||||||
from deluge._libtorrent import lt
|
from deluge._libtorrent import lt
|
||||||
from deluge.common import AUTH_LEVEL_ADMIN, is_magnet
|
from deluge.common import AUTH_LEVEL_ADMIN, is_magnet
|
||||||
from deluge.core.rpcserver import export
|
from deluge.core.rpcserver import export
|
||||||
|
from deluge.error import AddTorrentError
|
||||||
from deluge.event import DelugeEvent
|
from deluge.event import DelugeEvent
|
||||||
from deluge.plugins.pluginbase import CorePluginBase
|
from deluge.plugins.pluginbase import CorePluginBase
|
||||||
|
|
||||||
|
@ -277,6 +278,7 @@ class Core(CorePluginBase):
|
||||||
self.invalid_torrents[filename] = 1
|
self.invalid_torrents[filename] = 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
# The torrent looks good, so lets add it to the session.
|
# The torrent looks good, so lets add it to the session.
|
||||||
if magnet:
|
if magnet:
|
||||||
torrent_id = component.get('Core').add_torrent_magnet(
|
torrent_id = component.get('Core').add_torrent_magnet(
|
||||||
|
@ -284,6 +286,10 @@ class Core(CorePluginBase):
|
||||||
else:
|
else:
|
||||||
torrent_id = component.get('Core').add_torrent_file(
|
torrent_id = component.get('Core').add_torrent_file(
|
||||||
filename, base64.encodestring(filedump), options)
|
filename, base64.encodestring(filedump), options)
|
||||||
|
except AddTorrentError as ex:
|
||||||
|
log.error(ex)
|
||||||
|
os.rename(filepath, filepath + '.invalid')
|
||||||
|
continue
|
||||||
|
|
||||||
# If the torrent added successfully, set the extra options.
|
# If the torrent added successfully, set the extra options.
|
||||||
if torrent_id:
|
if torrent_id:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue