"http://packages.linuxdeepin.com/deepin/pool/main/d/deepinwine-qq2011/deepinwine-qq2011_0.0.1_i386.deb", "http://packages.linuxdeepin.com/deepin/pool/main/d/deepinwine-qq2009/deepinwine-qq2009_0.0.2_all.deb" ] task_list = [ TaskObject(url) for url in url_list] def update_state(name, obj, data, output_file): progress = "%d%%" % data.progress speed = parse_bytes(data.speed) remaining = parse_time(data.remaining) filesize = parse_bytes(data.filesize) downloaded = parse_bytes(data.downloaded) print "%s: %s/s - %s, progress: %s, total: %s, remaining time: %s" % (output_file, speed, downloaded, progress, filesize, remaining) print "-----------------------------------------------------------" for task in task_list: task.signal.add_callback("update", update_state, None, task.output_file) fetch_service.add_missions(task_list) while True: try: fetch_service.join(5.0) except KeyboardInterrupt: sys.exit(0) raise SystemExit
"http://packages.linuxdeepin.com/deepin/pool/main/d/deepinwine-qq2011/deepinwine-qq2011_0.0.1_i386.deb", "http://packages.linuxdeepin.com/deepin/pool/main/d/deepinwine-qq2009/deepinwine-qq2009_0.0.2_all.deb" ] task_list = [TaskObject(url) for url in url_list] def update_state(task, data): progress = "%d%%" % data.progress speed = parse_bytes(data.speed) remaining = parse_time(data.remaining) filesize = parse_bytes(data.filesize) downloaded = parse_bytes(data.downloaded) print "%s: %s/s - %s, progress: %s, total: %s, remaining time: %s" % ( task.output_file, speed, downloaded, progress, filesize, remaining) print "-----------------------------------------------------------" for task in task_list: task.connect("update", update_state) fetch_service.add_missions(task_list) while True: try: fetch_service.join(5.0) except KeyboardInterrupt: sys.exit(0) raise SystemExit