make active shows downloads

This commit is contained in:
pyed 2016-07-03 06:38:00 +03:00
parent f34cc0e0b0
commit 8effb91413

View File

@ -368,9 +368,7 @@ func downs(ud *tgbotapi.Update) {
// Downloading or in queue to download // Downloading or in queue to download
if torrents[i].Status == transmission.StatusDownloading || if torrents[i].Status == transmission.StatusDownloading ||
torrents[i].Status == transmission.StatusDownloadPending { torrents[i].Status == transmission.StatusDownloadPending {
buf.WriteString(fmt.Sprintf("<%d> %s\n%s (%.1f%%) ↓ %s ↑ %s R:%s\n\n", buf.WriteString(fmt.Sprintf("<%d> %s\n", torrents[i].ID, torrents[i].Name))
torrents[i].ID, torrents[i].Name, torrents[i].TorrentStatus(), torrents[i].PercentDone*100,
humanize.Bytes(torrents[i].RateDownload), humanize.Bytes(torrents[i].RateUpload), torrents[i].Ratio()))
} }
} }
@ -393,10 +391,7 @@ func seeding(ud *tgbotapi.Update) {
for i := range torrents { for i := range torrents {
if torrents[i].Status == transmission.StatusSeeding || if torrents[i].Status == transmission.StatusSeeding ||
torrents[i].Status == transmission.StatusSeedPending { torrents[i].Status == transmission.StatusSeedPending {
buf.WriteString(fmt.Sprintf("<%d> %s\n%s DL: %s UL: %s R:%s\n\n", buf.WriteString(fmt.Sprintf("<%d> %s\n", torrents[i].ID, torrents[i].Name))
torrents[i].ID, torrents[i].Name, torrents[i].TorrentStatus(),
humanize.Bytes(torrents[i].DownloadedEver), humanize.Bytes(torrents[i].UploadedEver),
torrents[i].Ratio()))
} }
} }
@ -462,7 +457,7 @@ func checking(ud *tgbotapi.Update) {
send(buf.String(), ud.Message.Chat.ID) send(buf.String(), ud.Message.Chat.ID)
} }
// active will send torrents that are actively uploading // active will send torrents that are actively downloading or uploading
func active(ud *tgbotapi.Update) { func active(ud *tgbotapi.Update) {
torrents, err := Client.GetTorrents() torrents, err := Client.GetTorrents()
if err != nil { if err != nil {
@ -472,7 +467,8 @@ func active(ud *tgbotapi.Update) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
for i := range torrents { for i := range torrents {
if torrents[i].RateUpload > 0 { if torrents[i].RateDownload > 0 ||
torrents[i].RateUpload > 0 {
buf.WriteString(fmt.Sprintf("<%d> %s\n%s (%.1f%%) ↓ %s ↑ %s R:%s\n\n", buf.WriteString(fmt.Sprintf("<%d> %s\n%s (%.1f%%) ↓ %s ↑ %s R:%s\n\n",
torrents[i].ID, torrents[i].Name, torrents[i].TorrentStatus(), torrents[i].ID, torrents[i].Name, torrents[i].TorrentStatus(),
torrents[i].PercentDone*100, humanize.Bytes(torrents[i].RateDownload), torrents[i].PercentDone*100, humanize.Bytes(torrents[i].RateDownload),