From 309fa34b07e02bec13f3e904256445fdcdd50353 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Sat, 6 May 2023 07:48:05 -0500 Subject: [PATCH] Fix size representations in cgi script --- cgi-bin/main.go | 12 ++++++------ main.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cgi-bin/main.go b/cgi-bin/main.go index 8784844..5e667e2 100644 --- a/cgi-bin/main.go +++ b/cgi-bin/main.go @@ -84,7 +84,7 @@ func main() { fmt.Println("20 text/gemini\r") fmt.Println("```") - transmissionbt, err := transmissionrpc.New("", "", "", nil) + transmissionbt, err := transmissionrpc.New("127.0.0.1", "", "", nil) if err != nil { log.Fatalln(err) } @@ -107,8 +107,8 @@ func main() { fmt.Println() currentStats := [][]string{ - {"Uploaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CurrentStats.UploadedBytes))}, - {"Downloaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CurrentStats.DownloadedBytes))}, + {"Uploaded bytes", byteCountIEC(stats.CurrentStats.UploadedBytes)}, + {"Downloaded bytes", byteCountIEC(stats.CurrentStats.DownloadedBytes)}, {"Files added", fmt.Sprintf("%d", stats.CurrentStats.FilesAdded)}, {"Session count", fmt.Sprintf("%d", stats.CurrentStats.SessionCount)}, {"Time active", convertTime(stats.CurrentStats.SecondsActive)}, @@ -119,8 +119,8 @@ func main() { fmt.Println() cumulativeStats := [][]string{ - {"Uploaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CumulativeStats.UploadedBytes))}, - {"Downloaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CumulativeStats.DownloadedBytes))}, + {"Uploaded bytes", byteCountIEC(stats.CumulativeStats.UploadedBytes)}, + {"Downloaded bytes", byteCountIEC(stats.CumulativeStats.DownloadedBytes)}, {"Files added", fmt.Sprintf("%d", stats.CumulativeStats.FilesAdded)}, {"Session count", fmt.Sprintf("%d", stats.CumulativeStats.SessionCount)}, {"Time active", convertTime(stats.CumulativeStats.SecondsActive)}, @@ -169,7 +169,7 @@ func main() { torrentStats := [][]string{ {"Name", torrent.Name}, {"Activity Date", torrent.ActivityDate.String()}, - {"Total Size", byteCountIEC(int64(*&torrent.TotalSize))}, + {"Total Size", torrent.TotalSize.GiBString()}, {"Leechers", fmt.Sprintf("%d", torrent.Leechers)}, {"Seeders", fmt.Sprintf("%d", torrent.Seeders)}, } diff --git a/main.go b/main.go index 7f8b4b7..958a857 100644 --- a/main.go +++ b/main.go @@ -82,7 +82,7 @@ type TorrentStatsPageData struct { } func main() { - transmissionbt, err := transmissionrpc.New(os.Getenv("RPC_HOST"), os.Getenv("RPC_USER"), os.Getenv("RPC_PASSWD"), nil) + transmissionbt, err := transmissionrpc.New("127.0.0.1", "", "", nil) if err != nil { log.Fatalln(err) }