func (r *RTorrent) GetTorrents(view View) ([]Torrent, error) {
	args := []interface{}{"", string(view), DName.Query(), DSizeInBytes.Query(), DHash.Query(), DLabel.Query(), DBasePath.Query(), DIsActive.Query(), DComplete.Query(), DRatio.Query(), DCreationTime.Query(), DFinishedTime.Query(), DStartedTime.Query()}
	results, err := r.xmlrpcClient.Call("d.multicall2", args...)
	var torrents []Torrent
	if err != nil {
		return torrents, errors.Wrap(err, "d.multicall2 XMLRPC call failed")
	}
	for _, outerResult := range results.([]interface{}) {
		for _, innerResult := range outerResult.([]interface{}) {
			torrentData := innerResult.([]interface{})
			torrents = append(torrents, Torrent{
				Hash:      torrentData[2].(string),
				Name:      torrentData[0].(string),
				Path:      torrentData[4].(string),
				Size:      torrentData[1].(int),
				Label:     torrentData[3].(string),
				Completed: torrentData[6].(int) > 0,
				Ratio:     float64(torrentData[7].(int)) / float64(1000),
				Created:   time.Unix(int64(torrentData[8].(int)), 0),
				Finished:  time.Unix(int64(torrentData[9].(int)), 0),
				Started:   time.Unix(int64(torrentData[10].(int)), 0),
			})
		}
	}
	return torrents, nil
}
GetTorrents returns all of the torrents reported by this RTorrent instance
package rtorrent
import (
	"fmt"
	"net/http"
	"time"
	"github.com/mrobinsn/go-rtorrent/xmlrpc"
	"github.com/pkg/errors"
)
type RTorrent struct {
	addr         string
	xmlrpcClient *xmlrpc.Client
}
type FieldValue struct {
	Field Field
	Value string
}
type Torrent struct {
	Hash      string
	Name      string
	Path      string
	Size      int
	Label     string
	Completed bool
	Ratio     float64
	Created   time.Time
	Started   time.Time
	Finished  time.Time
}
type Status struct {
	Completed      bool
	CompletedBytes int
	DownRate       int
	UpRate         int
	Ratio          float64
	Size           int
}
type File struct {
	Path string
	Size int
}
type Field string
type View string
const (
	ViewMain View = "main"
	ViewStarted View = "started"
	ViewStopped View = "stopped"
	ViewHashing View = "hashing"
	ViewSeeding View = "seeding"
	DName Field = "d.name"
	DLabel Field = "d.custom1"
	DSizeInBytes Field = "d.size_bytes"
	DHash Field = "d.hash"
	DBasePath Field = "d.base_path"
	DIsActive Field = "d.is_active"
	DRatio Field = "d.ratio"
	DComplete Field = "d.complete"
	DCompletedBytes Field = "d.completed_bytes"
	DDownRate Field = "d.down.rate"
	DUpRate Field = "d.up.rate"
	DCreationTime Field = "d.creation_date"
	DFinishedTime Field = "d.timestamp.finished"
	DStartedTime Field = "d.timestamp.started"
	FPath Field = "f.path"
	FSizeInBytes Field = "f.size_bytes"
)
func (f Field) Query() string {
	return fmt.Sprintf("%s=", f)
}
func (f Field) SetValue(value string) *FieldValue {
	return &FieldValue{f, value}
}
func (f Field) Cmd() string {
	return string(f)
}
func (f *FieldValue) String() string {
	return fmt.Sprintf("%s.set=\"%s\"", f.Field, f.Value)
}
func (t *Torrent) Pretty() string {
	return fmt.Sprintf("Torrent:\n\tHash: %v\n\tName: %v\n\tPath: %v\n\tLabel: %v\n\tSize: %v bytes\n\tCompleted: %v\n\tRatio: %v\n", t.Hash, t.Name, t.Path, t.Label, t.Size, t.Completed, t.Ratio)
}
func (f *File) Pretty() string {
	return fmt.Sprintf("File:\n\tPath: %v\n\tSize: %v bytes\n", f.Path, f.Size)
}
func New(addr string, insecure bool) *RTorrent {
	return &RTorrent{
		addr:         addr,
		xmlrpcClient: xmlrpc.NewClient(addr, insecure),
	}
}
func (r *RTorrent) WithHTTPClient(client *http.Client) *RTorrent {
	r.xmlrpcClient = xmlrpc.NewClientWithHTTPClient(r.addr, client)
	return r
}
func (r *RTorrent) AddStopped(url string, extraArgs ...*FieldValue) error {
	return r.add("load.normal", []byte(url), extraArgs...)
}
func (r *RTorrent) Add(url string, extraArgs ...*FieldValue) error {
	return r.add("load.start", []byte(url), extraArgs...)
}
func (r *RTorrent) AddTorrentStopped(data []byte, extraArgs ...*FieldValue) error {
	return r.add("load.raw", data, extraArgs...)
}
func (r *RTorrent) AddTorrent(data []byte, extraArgs ...*FieldValue) error {
	return r.add("load.raw_start", data, extraArgs...)
}
func (r *RTorrent) add(cmd string, data []byte, extraArgs ...*FieldValue) error {
	args := []interface{}{data}
	for _, v := range extraArgs {
		args = append(args, v.String())
	}
	_, err := r.xmlrpcClient.Call(cmd, "", args)
	if err != nil {
		return errors.Wrap(err, fmt.Sprintf("%s XMLRPC call failed", cmd))
	}
	return nil
}
func (r *RTorrent) IP() (string, error) {
	result, err := r.xmlrpcClient.Call("network.bind_address")
	if err != nil {
		return "", errors.Wrap(err, "network.bind_address XMLRPC call failed")
	}
	if ips, ok := result.([]interface{}); ok {
		result = ips[0]
	}
	if ip, ok := result.(string); ok {
		return ip, nil
	}
	return "", errors.Errorf("result isn't string: %v", result)
}
func (r *RTorrent) Name() (string, error) {
	result, err := r.xmlrpcClient.Call("system.hostname")
	if err != nil {
		return "", errors.Wrap(err, "system.hostname XMLRPC call failed")
	}
	if names, ok := result.([]interface{}); ok {
		result = names[0]
	}
	if name, ok := result.(string); ok {
		return name, nil
	}
	return "", errors.Errorf("result isn't string: %v", result)
}
func (r *RTorrent) DownTotal() (int, error) {
	result, err := r.xmlrpcClient.Call("throttle.global_down.total")
	if err != nil {
		return 0, errors.Wrap(err, "throttle.global_down.total XMLRPC call failed")
	}
	if totals, ok := result.([]interface{}); ok {
		result = totals[0]
	}
	if total, ok := result.(int); ok {
		return total, nil
	}
	return 0, errors.Errorf("result isn't int: %v", result)
}
func (r *RTorrent) DownRate() (int, error) {
	result, err := r.xmlrpcClient.Call("throttle.global_down.rate")
	if err != nil {
		return 0, errors.Wrap(err, "throttle.global_down.rate XMLRPC call failed")
	}
	if totals, ok := result.([]interface{}); ok {
		result = totals[0]
	}
	if total, ok := result.(int); ok {
		return total, nil
	}
	return 0, errors.Errorf("result isn't int: %v", result)
}
func (r *RTorrent) UpTotal() (int, error) {
	result, err := r.xmlrpcClient.Call("throttle.global_up.total")
	if err != nil {
		return 0, errors.Wrap(err, "throttle.global_up.total XMLRPC call failed")
	}
	if totals, ok := result.([]interface{}); ok {
		result = totals[0]
	}
	if total, ok := result.(int); ok {
		return total, nil
	}
	return 0, errors.Errorf("result isn't int: %v", result)
}
func (r *RTorrent) UpRate() (int, error) {
	result, err := r.xmlrpcClient.Call("throttle.global_up.rate")
	if err != nil {
		return 0, errors.Wrap(err, "throttle.global_up.rate XMLRPC call failed")
	}
	if totals, ok := result.([]interface{}); ok {
		result = totals[0]
	}
	if total, ok := result.(int); ok {
		return total, nil
	}
	return 0, errors.Errorf("result isn't int: %v", result)
}