]>
code.delx.au - webdl/blob - grabber.py
2 # vim:ts=4:sts=4:sw=4:noet
4 from common
import load_root_node
7 def choose(options
, allow_multi
):
8 skeys
= sorted(options
.keys())
9 for i
, key
in enumerate(skeys
):
10 print " %d) %s" % (i
+1, key
)
14 values
= map(int, raw_input("Choose> ").split())
19 values
= [options
[skeys
[value
-1]] for value
in values
]
25 except (ValueError, IndexError):
26 print >>sys
.stderr
, "Invalid input, please try again"
30 node
= load_root_node()
35 for n
in node
.get_children():
37 if not n
.can_download
:
39 result
= choose(options
, allow_multi
=will_download
)
41 if node
.parent
is not None:
48 raw_input("Press return to continue...\n")
52 if __name__
== "__main__":
55 except (KeyboardInterrupt, EOFError):