mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-18 07:11:04 +00:00
[#2703] [Core] Stop moving files if target files exist
This commit is contained in:
parent
244ae878c9
commit
560318a5a7
@ -855,13 +855,16 @@ class Torrent(object):
|
|||||||
log.error("Could not move storage for torrent %s since %s does not exist and could not create the directory.", self.torrent_id, dest_u)
|
log.error("Could not move storage for torrent %s since %s does not exist and could not create the directory.", self.torrent_id, dest_u)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
kwargs = {}
|
||||||
|
if deluge.common.VersionSplit(lt.version) >= deluge.common.VersionSplit("1.0.0.0"):
|
||||||
|
kwargs['flags'] = 1 # fail_if_exist
|
||||||
dest_bytes = dest.encode('utf-8')
|
dest_bytes = dest.encode('utf-8')
|
||||||
try:
|
try:
|
||||||
# libtorrent needs unicode object if wstrings are enabled, utf8 bytestring otherwise
|
# libtorrent needs unicode object if wstrings are enabled, utf8 bytestring otherwise
|
||||||
try:
|
try:
|
||||||
self.handle.move_storage(dest)
|
self.handle.move_storage(dest, **kwargs)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.handle.move_storage(dest_bytes)
|
self.handle.move_storage(dest_bytes, **kwargs)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error("Error calling libtorrent move_storage: %s" % e)
|
log.error("Error calling libtorrent move_storage: %s" % e)
|
||||||
return False
|
return False
|
||||||
|
@ -1064,6 +1064,7 @@ class TorrentManager(component.Component):
|
|||||||
except (RuntimeError, KeyError):
|
except (RuntimeError, KeyError):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
log.error("Torrent %s, %s", torrent_id, decode_string(alert.message()))
|
||||||
if torrent_id in self.waiting_on_finish_moving:
|
if torrent_id in self.waiting_on_finish_moving:
|
||||||
self.waiting_on_finish_moving.remove(torrent_id)
|
self.waiting_on_finish_moving.remove(torrent_id)
|
||||||
torrent.is_finished = True
|
torrent.is_finished = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user