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("20 text/gemini\r")
fmt.Println("```") fmt.Println("```")
transmissionbt, err := transmissionrpc.New("", "", "", nil) transmissionbt, err := transmissionrpc.New("127.0.0.1", "", "", nil)
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)
} }
@ -107,8 +107,8 @@ func main() {
fmt.Println() fmt.Println()
currentStats := [][]string{ currentStats := [][]string{
{"Uploaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CurrentStats.UploadedBytes))}, {"Uploaded bytes", byteCountIEC(stats.CurrentStats.UploadedBytes)},
{"Downloaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CurrentStats.DownloadedBytes))}, {"Downloaded bytes", byteCountIEC(stats.CurrentStats.DownloadedBytes)},
{"Files added", fmt.Sprintf("%d", stats.CurrentStats.FilesAdded)}, {"Files added", fmt.Sprintf("%d", stats.CurrentStats.FilesAdded)},
{"Session count", fmt.Sprintf("%d", stats.CurrentStats.SessionCount)}, {"Session count", fmt.Sprintf("%d", stats.CurrentStats.SessionCount)},
{"Time active", convertTime(stats.CurrentStats.SecondsActive)}, {"Time active", convertTime(stats.CurrentStats.SecondsActive)},
@ -119,8 +119,8 @@ func main() {
fmt.Println() fmt.Println()
cumulativeStats := [][]string{ cumulativeStats := [][]string{
{"Uploaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CumulativeStats.UploadedBytes))}, {"Uploaded bytes", byteCountIEC(stats.CumulativeStats.UploadedBytes)},
{"Downloaded bytes", fmt.Sprintf("%s", byteCountIEC(stats.CumulativeStats.DownloadedBytes))}, {"Downloaded bytes", byteCountIEC(stats.CumulativeStats.DownloadedBytes)},
{"Files added", fmt.Sprintf("%d", stats.CumulativeStats.FilesAdded)}, {"Files added", fmt.Sprintf("%d", stats.CumulativeStats.FilesAdded)},
{"Session count", fmt.Sprintf("%d", stats.CumulativeStats.SessionCount)}, {"Session count", fmt.Sprintf("%d", stats.CumulativeStats.SessionCount)},
{"Time active", convertTime(stats.CumulativeStats.SecondsActive)}, {"Time active", convertTime(stats.CumulativeStats.SecondsActive)},
@ -169,7 +169,7 @@ func main() {
torrentStats := [][]string{ torrentStats := [][]string{
{"Name", torrent.Name}, {"Name", torrent.Name},
{"Activity Date", torrent.ActivityDate.String()}, {"Activity Date", torrent.ActivityDate.String()},
{"Total Size", byteCountIEC(int64(*&torrent.TotalSize))}, {"Total Size", torrent.TotalSize.GiBString()},
{"Leechers", fmt.Sprintf("%d", torrent.Leechers)}, {"Leechers", fmt.Sprintf("%d", torrent.Leechers)},
{"Seeders", fmt.Sprintf("%d", torrent.Seeders)}, {"Seeders", fmt.Sprintf("%d", torrent.Seeders)},
} }

View File

@ -82,7 +82,7 @@ type TorrentStatsPageData struct {
} }
func main() { 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 { if err != nil {
log.Fatalln(err) log.Fatalln(err)
} }