From: Matt Joiner Date: Thu, 24 Apr 2025 13:03:50 +0000 (+1000) Subject: Include incomplete torrent count in client status X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=03d0c538a3837d4082770d9e5efc0a412621b55e;p=btrtrc.git Include incomplete torrent count in client status --- diff --git a/client.go b/client.go index 1d618f97..f1d29d06 100644 --- a/client.go +++ b/client.go @@ -160,7 +160,13 @@ func (cl *Client) WriteStatus(_w io.Writer) { }) dumpStats(w, cl.statsLocked()) torrentsSlice := cl.torrentsAsSlice() - fmt.Fprintf(w, "# Torrents: %d\n", len(torrentsSlice)) + incomplete := 0 + for _, t := range torrentsSlice { + if !t.Complete().Bool() { + incomplete++ + } + } + fmt.Fprintf(w, "# Torrents: %d (%v incomplete)\n", len(torrentsSlice), incomplete) fmt.Fprintln(w) sort.Slice(torrentsSlice, func(l, r int) bool { return torrentsSlice[l].canonicalShortInfohash().AsString() < torrentsSlice[r].canonicalShortInfohash().AsString()