From 03d0c538a3837d4082770d9e5efc0a412621b55e Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 24 Apr 2025 23:03:50 +1000 Subject: [PATCH] Include incomplete torrent count in client status --- client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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() -- 2.48.1