(self)
| 255 | pass |
| 256 | |
| 257 | def processCommand(self): |
| 258 | command = self.command[0] |
| 259 | args = [] |
| 260 | if len(self.command) > 1: |
| 261 | args = self.command[1:] |
| 262 | |
| 263 | if command == "status": |
| 264 | files = self.client.statusDownloads() |
| 265 | |
| 266 | if not files: |
| 267 | print "No downloads running." |
| 268 | |
| 269 | for download in files: |
| 270 | if download.status == 12: # downloading |
| 271 | print print_status(download) |
| 272 | print "\tDownloading: %s @ %s/s\t %s (%s%%)" % ( |
| 273 | download.format_eta, formatSize(download.speed), formatSize(download.size - download.bleft), |
| 274 | download.percent) |
| 275 | elif download.status == 5: |
| 276 | print print_status(download) |
| 277 | print "\tWaiting: %s" % download.format_wait |
| 278 | else: |
| 279 | print print_status(download) |
| 280 | |
| 281 | elif command == "queue": |
| 282 | print_packages(self.client.getQueueData()) |
| 283 | |
| 284 | elif command == "collector": |
| 285 | print_packages(self.client.getCollectorData()) |
| 286 | |
| 287 | elif command == "add": |
| 288 | if len(args) < 2: |
| 289 | print _("Please use this syntax: add <Package name> <link> <link2> ...") |
| 290 | return |
| 291 | |
| 292 | self.client.addPackage(args[0], args[1:], Destination.Queue) |
| 293 | |
| 294 | elif command == "add_coll": |
| 295 | if len(args) < 2: |
| 296 | print _("Please use this syntax: add <Package name> <link> <link2> ...") |
| 297 | return |
| 298 | |
| 299 | self.client.addPackage(args[0], args[1:], Destination.Collector) |
| 300 | |
| 301 | elif command == "del_file": |
| 302 | self.client.deleteFiles([int(x) for x in args]) |
| 303 | print "Files deleted." |
| 304 | |
| 305 | elif command == "del_package": |
| 306 | self.client.deletePackages([int(x) for x in args]) |
| 307 | print "Packages deleted." |
| 308 | |
| 309 | elif command == "move": |
| 310 | for pid in args: |
| 311 | pack = self.client.getPackageInfo(int(pid)) |
| 312 | self.client.movePackage((pack.dest + 1) % 2, pack.pid) |
| 313 | |
| 314 | elif command == "check": |
no test coverage detected