Module: deluge
Branch: master
Commit: ee75786e4047c750ecf26f04746cb92df42999cc

Author: Nick Lanham <[email protected]>
Date:   Thu Feb 24 12:08:42 2011 +0100

handle the case where libtorrent doesn't know what files are in a torrent.
this is the case when torrent was added by a magnet link

---

 deluge/ui/console/modes/torrentdetail.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/deluge/ui/console/modes/torrentdetail.py 
b/deluge/ui/console/modes/torrentdetail.py
index 646e00b..4c5d41e 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -123,9 +123,12 @@ class TorrentDetail(BaseMode, component.Component):
         log.debug("got state")
         if not self.file_list:
             # don't keep getting the files once we've got them once
-            self.files_sep = "{!green,black,bold,underline!}%s"%(("Files 
(torrent has %d files)"%len(state["files"])).center(self.cols))
-            self.file_list,self.file_dict = 
self.build_file_list(state["files"],state["file_progress"],state["file_priorities"])
-            self._status_keys.remove("files")
+            if state.get("files"):
+                self.files_sep = "{!green,black,bold,underline!}%s"%(("Files 
(torrent has %d files)"%len(state["files"])).center(self.cols))
+                self.file_list,self.file_dict = 
self.build_file_list(state["files"],state["file_progress"],state["file_priorities"])
+                self._status_keys.remove("files")
+            else:
+                self.files_sep = "{!green,black,bold,underline!}%s"%(("Files 
(File list unknown)").center(self.cols))
         self._fill_progress(self.file_list,state["file_progress"])
         for i,prio in enumerate(state["file_priorities"]):
             self.file_dict[i][6] = prio
@@ -187,6 +190,7 @@ class TorrentDetail(BaseMode, component.Component):
     # fills in progress fields in all entries based on progs
     # returns the # of bytes complete in all the children of fs
     def _fill_progress(self,fs,progs):
+        if not progs: return 0
         tb = 0
         for f in fs:
             if f[3]: # dir, has some children

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to