Now able to specify if the .torrent file gets deleted when removing a
torrent.
This commit is contained in:
parent
ed76e66e3d
commit
3d1e4017d3
|
@ -295,13 +295,17 @@ class Manager:
|
||||||
self.add_torrent_ns(filename, save_dir, compact)
|
self.add_torrent_ns(filename, save_dir, compact)
|
||||||
return self.sync() # Syncing will create a new torrent in the core, and return it's ID
|
return self.sync() # Syncing will create a new torrent in the core, and return it's ID
|
||||||
|
|
||||||
def remove_torrent(self, unique_ID, data_also):
|
def remove_torrent(self, unique_ID, data_also, torrent_also):
|
||||||
temp = self.unique_IDs[unique_ID]
|
temp = self.unique_IDs[unique_ID]
|
||||||
temp_fileinfo = deluge_core.get_file_info(unique_ID)
|
temp_fileinfo = deluge_core.get_file_info(unique_ID)
|
||||||
|
|
||||||
self.remove_torrent_ns(unique_ID)
|
self.remove_torrent_ns(unique_ID)
|
||||||
self.sync()
|
self.sync()
|
||||||
|
|
||||||
|
# Remove .torrent file if asked to do so
|
||||||
|
if torrent_also:
|
||||||
|
os.remove(temp.filename)
|
||||||
|
|
||||||
# Remove data, if asked to do so
|
# Remove data, if asked to do so
|
||||||
if data_also:
|
if data_also:
|
||||||
# Must be done AFTER the torrent is removed
|
# Must be done AFTER the torrent is removed
|
||||||
|
@ -676,8 +680,7 @@ class Manager:
|
||||||
for unique_ID in to_delete:
|
for unique_ID in to_delete:
|
||||||
self.state.torrents.remove(self.unique_IDs[unique_ID])
|
self.state.torrents.remove(self.unique_IDs[unique_ID])
|
||||||
self.state.queue.remove(unique_ID)
|
self.state.queue.remove(unique_ID)
|
||||||
# Remove .torrent and .fastresume
|
# Remove .fastresume
|
||||||
os.remove(self.unique_IDs[unique_ID].filename)
|
|
||||||
try:
|
try:
|
||||||
# Must be after removal of the torrent, because that saves a new .fastresume
|
# Must be after removal of the torrent, because that saves a new .fastresume
|
||||||
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
||||||
|
|
|
@ -941,6 +941,7 @@ class DelugeGTK:
|
||||||
warning = glade.get_widget("warning")
|
warning = glade.get_widget("warning")
|
||||||
warning.set_text(" ")
|
warning.set_text(" ")
|
||||||
|
|
||||||
|
torrent_also = glade.get_widget("torrent_also")
|
||||||
data_also = glade.get_widget("data_also")
|
data_also = glade.get_widget("data_also")
|
||||||
data_also.connect("toggled", self.remove_toggle_warning, warning)
|
data_also.connect("toggled", self.remove_toggle_warning, warning)
|
||||||
|
|
||||||
|
@ -956,7 +957,7 @@ class DelugeGTK:
|
||||||
else:
|
else:
|
||||||
self.torrent_selected = None
|
self.torrent_selected = None
|
||||||
|
|
||||||
self.manager.remove_torrent(torrent, data_also.get_active())
|
self.manager.remove_torrent(torrent, data_also.get_active(), torrent_also.get_active())
|
||||||
self.clear_details_pane()
|
self.clear_details_pane()
|
||||||
|
|
||||||
def clear_details_pane(self):
|
def clear_details_pane(self):
|
||||||
|
|
Loading…
Reference in New Issue