fix: use session-stats instead of session-get for stats

This commit is contained in:
2026-07-08 14:41:04 -03:00
parent 04cd31e107
commit 9981d0bc19

View File

@@ -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 {