mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Fix #85 change torrent state to downloading if changing priority of files in torrent to something other than
'Do Not Download'.
This commit is contained in:
parent
0f4895ee6a
commit
1558ab8607
2 changed files with 12 additions and 1 deletions
|
@ -147,6 +147,16 @@ class Torrent:
|
||||||
self.save_path = save_path
|
self.save_path = save_path
|
||||||
|
|
||||||
def set_file_priorities(self, file_priorities):
|
def set_file_priorities(self, file_priorities):
|
||||||
|
log.debug("setting %s's file priorities: %s", self.torrent_id, file_priorities)
|
||||||
|
if 0 in self.file_priorities:
|
||||||
|
# We have previously marked a file 'Do Not Download'
|
||||||
|
# Check to see if we have changed any 0's to >0 and change state accordingly
|
||||||
|
for index, priority in enumerate(self.file_priorities):
|
||||||
|
if priority == 0 and file_priorities[index] > 0:
|
||||||
|
# We have a changed 'Do Not Download' to a download priority
|
||||||
|
self.set_state("Downloading")
|
||||||
|
break
|
||||||
|
|
||||||
self.file_priorities = file_priorities
|
self.file_priorities = file_priorities
|
||||||
self.handle.prioritize_files(file_priorities)
|
self.handle.prioritize_files(file_priorities)
|
||||||
|
|
||||||
|
|
|
@ -602,6 +602,7 @@ class TorrentManager(component.Component):
|
||||||
# Get the torrent_id
|
# Get the torrent_id
|
||||||
torrent_id = str(alert.handle.info_hash())
|
torrent_id = str(alert.handle.info_hash())
|
||||||
log.debug("%s is finished..", torrent_id)
|
log.debug("%s is finished..", torrent_id)
|
||||||
|
|
||||||
# Queue to bottom if enabled
|
# Queue to bottom if enabled
|
||||||
if alert.msg() == "torrent has finished downloading":
|
if alert.msg() == "torrent has finished downloading":
|
||||||
if self.config["queue_finished_to_bottom"]:
|
if self.config["queue_finished_to_bottom"]:
|
||||||
|
@ -632,7 +633,7 @@ class TorrentManager(component.Component):
|
||||||
|
|
||||||
# Write the fastresume file
|
# Write the fastresume file
|
||||||
self.torrents[torrent_id].write_fastresume()
|
self.torrents[torrent_id].write_fastresume()
|
||||||
|
|
||||||
def on_alert_torrent_checked(self, alert):
|
def on_alert_torrent_checked(self, alert):
|
||||||
log.debug("on_alert_torrent_checked")
|
log.debug("on_alert_torrent_checked")
|
||||||
# Get the torrent_id
|
# Get the torrent_id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue