mirror of
https://codeberg.org/hyperreal/go-transmission-stats
synced 2024-11-25 12:13:42 +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("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)},
|
||||||
}
|
}
|
||||||
|
2
main.go
2
main.go
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user