From 4f0b0fedb805befd0bda2d2a6f534d9df1f4fe2d Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Wed, 26 Jun 2019 17:34:55 -0700 Subject: [PATCH] Add Transmission seed ratio to display --- modules/transmission/display.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/transmission/display.go b/modules/transmission/display.go index 3d7b2c69..9780487c 100644 --- a/modules/transmission/display.go +++ b/modules/transmission/display.go @@ -16,9 +16,10 @@ func (widget *Widget) contentFrom(data []*transmissionrpc.Torrent) string { torrName := *torrent.Name row := fmt.Sprintf( - "[%s] %s %s%s[white]", + "[%s] %s %s %s%s[white]", widget.RowColor(idx), widget.torrentPercentDone(torrent), + widget.torrentSeedRatio(torrent), widget.torrentState(torrent), tview.Escape(widget.prettyTorrentName(torrName)), ) @@ -48,7 +49,7 @@ func (widget *Widget) prettyTorrentName(name string) string { func (widget *Widget) torrentPercentDone(torrent *transmissionrpc.Torrent) string { pctDone := *torrent.PercentDone - str := fmt.Sprintf("%3d%%", int(pctDone*100)) + str := fmt.Sprintf("%3d%%↓", int(pctDone*100)) if pctDone == 0.0 { str = "[gray::b]" + str @@ -61,6 +62,11 @@ func (widget *Widget) torrentPercentDone(torrent *transmissionrpc.Torrent) strin return str + "[white]" } +func (widget *Widget) torrentSeedRatio(torrent *transmissionrpc.Torrent) string { + seedRatio := *torrent.UploadRatio + return fmt.Sprintf("[green]%3d%%↑", int(seedRatio*100)) +} + func (widget *Widget) torrentState(torrent *transmissionrpc.Torrent) string { str := ""