mirror of
https://codeberg.org/hyperreal/go-transmission-stats
synced 2024-11-01 08:43:10 +01:00
Fix size representations in cgi script
This commit is contained in:
parent
48ec91102c
commit
309fa34b07
@ -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)},
|
||||
}
|
||||
|
2
main.go
2
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user