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
|
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) {
|
func (c *Client) Stats(ctx context.Context) (json.RawMessage, error) {
|
||||||
reqBody, _ := json.Marshal(rpcRequest{
|
reqBody, _ := json.Marshal(rpcRequest{
|
||||||
Method: "session-get",
|
Method: "session-stats",
|
||||||
Arguments: rpcArgs{Fields: sessionFields},
|
|
||||||
})
|
})
|
||||||
data, err := c.rpc(ctx, reqBody)
|
data, err := c.rpc(ctx, reqBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user