func (self *PiDownloader) getActive(args []string) (string, error) {
	keys := []string{"gid", "totalLength", "completedLength", "downloadSpeed", "bittorrent", "files"}
	tasks, err := aria2rpc.GetActive(keys)
	if err != nil {
		return "", err
	}
	return self.formatOutput(tasks)
}
func (self *PiDownloader) getCurrentDownloadInfo() (string, error) {
	globalStat, getStatErr := aria2rpc.GetGlobalStat()
	if getStatErr != nil {
		return "", getStatErr
	}
	// total active download task
	numActive, _ := strconv.Atoi(globalStat["numActive"].(string))
	if numActive == 0 {
		return "no active task", nil
	}

	// total speed
	speed := utils.FormatSizeString(globalStat["downloadSpeed"].(string))

	// the longest left time in active download task
	var longestTimeLeft int64 = -1
	keys := []string{"gid", "totalLength", "completedLength", "downloadSpeed"}
	tasks, getActErr := aria2rpc.GetActive(keys)
	if getActErr != nil {
		return "", getActErr
	}
	for _, task := range tasks {
		dSpd := task["downloadSpeed"]
		if dSpd != nil {
			total, _ := strconv.ParseInt(task["totalLength"].(string), 10, 64)
			completed, _ := strconv.ParseInt(task["completedLength"].(string), 10, 64)
			spd, _ := strconv.ParseInt(dSpd.(string), 10, 64)
			if spd > 0 {
				timeLeft := (total - completed) / spd
				if timeLeft > longestTimeLeft {
					longestTimeLeft = timeLeft
				}
			}
		}
	}

	var timeLeftFmt string
	if longestTimeLeft > 0 {
		timeLeftFmt = utils.FormatTime(longestTimeLeft)
	} else {
		timeLeftFmt = "N/A"
	}
	return fmt.Sprintf("spd: %s ; act: %d ; left: %s", speed, numActive, timeLeftFmt), nil
}