From 713e264061ca829b3ab5d3e7c7529f46da6983d0 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 8 Aug 2014 19:26:37 +0100 Subject: [PATCH] Fix for moving progress with no data downloaded --- deluge/core/torrent.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index af64e71cc..45147c2d5 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -883,9 +883,13 @@ class Torrent(object): progress = 100.0 elif self.moving_storage: torrent_status = self.get_status(["files", "total_done"]) - torrent_files = [f['path'] for f in torrent_status["files"]] - dest_path_size = get_size(torrent_files, self.moving_storage_dest_path) - progress = dest_path_size / torrent_status["total_done"] * 100 + # Check if torrent has downloaded any data yet. + if torrent_status["total_done"]: + torrent_files = [f['path'] for f in torrent_status["files"]] + dest_path_size = get_size(torrent_files, self.moving_storage_dest_path) + progress = dest_path_size / torrent_status["total_done"] * 100 + else: + progress = 100.0 else: progress = self.status.progress * 100