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:
Andrew Resch 2008-04-13 04:16:33 +00:00
parent 0f4895ee6a
commit 1558ab8607
2 changed files with 12 additions and 1 deletions

View File

@ -147,6 +147,16 @@ class Torrent:
self.save_path = save_path
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.handle.prioritize_files(file_priorities)

View File

@ -602,6 +602,7 @@ class TorrentManager(component.Component):
# Get the torrent_id
torrent_id = str(alert.handle.info_hash())
log.debug("%s is finished..", torrent_id)
# Queue to bottom if enabled
if alert.msg() == "torrent has finished downloading":
if self.config["queue_finished_to_bottom"]:
@ -632,7 +633,7 @@ class TorrentManager(component.Component):
# Write the fastresume file
self.torrents[torrent_id].write_fastresume()
def on_alert_torrent_checked(self, alert):
log.debug("on_alert_torrent_checked")
# Get the torrent_id