Fix size representations in cgi script

This commit is contained in:
Jeffrey Serio 2023-05-06 07:48:05 -05:00
parent 48ec91102c
commit 309fa34b07
2 changed files with 7 additions and 7 deletions

View File

@ -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)},
}

View File

@ -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)
}