fix: use session-stats instead of session-get for stats
This commit is contained in:
9
main.go
9
main.go
@@ -129,16 +129,9 @@ func (c *Client) Torrents(ctx context.Context) (json.RawMessage, error) {
|
||||
return resp.Args, nil
|
||||
}
|
||||
|
||||
// sessionFields requested for stats.
|
||||
var sessionFields = []string{
|
||||
"downloadSpeed", "uploadSpeed", "torrentCount", "activeTorrentCount",
|
||||
"pausedTorrentCount", "cumulativeDownloaded", "cumulativeUploaded",
|
||||
}
|
||||
|
||||
func (c *Client) Stats(ctx context.Context) (json.RawMessage, error) {
|
||||
reqBody, _ := json.Marshal(rpcRequest{
|
||||
Method: "session-get",
|
||||
Arguments: rpcArgs{Fields: sessionFields},
|
||||
Method: "session-stats",
|
||||
})
|
||||
data, err := c.rpc(ctx, reqBody)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user