MCPcopy
hub / github.com/pyload/pyload / processCommand

Method processCommand

pyLoadCli.py:257–356  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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":

Callers 1

__init__Method · 0.95

Calls 15

printOnlineCheckMethod · 0.95
formatSizeFunction · 0.90
print_statusFunction · 0.85
print_packagesFunction · 0.85
existsFunction · 0.85
print_commandsFunction · 0.85
_Function · 0.50
statusDownloadsMethod · 0.45
getQueueDataMethod · 0.45
getCollectorDataMethod · 0.45
addPackageMethod · 0.45
deleteFilesMethod · 0.45

Tested by

no test coverage detected