qbittorrent

package
v0.0.0-...-270697f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateError       = "Error"                           //Some error occurred, applies to paused torrents
	StatePausedUP    = "Upload Paused"                   //Torrent is paused and has finished downloading
	StatePausedDL    = "Download Paused"                 //Torrent is paused and has NOT finished downloading
	StateQueuedUP    = "Upload Queued"                   //Queuing is enabled and torrent is queued for upload
	StateQueuedDL    = "Download Queued"                 //Queuing is enabled and torrent is queued for download
	StateUploading   = "Uploading"                       //Torrent is being seeded and data is being transfered
	StateStalledUP   = "Uploading, connection waiting"   //Torrent is being seeded, but no connection were made
	StateCheckingUP  = "Upload Checking"                 //Torrent has finished downloading and is being checked; this status also applies to preallocation (if enabled) and checking resume data on qBt startup
	StateCheckingDL  = "Download File Checking"          //Same as checkingUP, but torrent has NOT finished downloading
	StateDownloading = "Downloading"                     //Torrent is being downloaded and data is being transfered
	StateStalledDL   = "Donwloading, connection waiting" //Torrent is being downloaded, but no connection were made
	StateMetaDL      = "Fetching Metadata"               //Torrent has just started downloading and is fetching metadata
)

Variables

View Source
var TorrentState = &State{
	"error":       StateError,
	"pausedUP":    StatePausedUP,
	"pausedDL":    StatePausedDL,
	"queuedUP":    StateQueuedUP,
	"queuedDL":    StateQueuedDL,
	"uploading":   StateUploading,
	"stalledUP":   StateStalledUP,
	"checkingUP":  StateCheckingUP,
	"checkingDL":  StateCheckingDL,
	"downloading": StateDownloading,
	"stalledDL":   StateStalledDL,
	"metaDL":      StateMetaDL,
}

TorrentState ...

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL   string
	Username  string
	Password  string
	Token     string
	Cookies   http.CookieJar
	Authorize string
	// contains filtered or unexported fields
}

Client ... qBittorrent Configure

func NewClient

func NewClient(baseURL string, username string, password string) (qb *Client, err error)

NewClient ...

func (*Client) APIMinimumVersion

func (qb *Client) APIMinimumVersion() (string, error)

APIMinimumVersion ...

func (*Client) APIVersion

func (qb *Client) APIVersion() (string, error)

APIVersion ...

func (*Client) Command

func (qb *Client) Command(action string, hash []string) error

Command ...

func (*Client) ListTorrent

func (qb *Client) ListTorrent() (torrents *[]Torrent, err error)

ListTorrent ...

func (*Client) Logout

func (qb *Client) Logout() error

Logout ...

type State

type State map[string]string

State ...

type Torrent

type Torrent struct {
	//https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-Documentation#get-torrent-list
	Hash                   string  `json:"hash"`           //Torrent hash
	Name                   string  `json:"name"`           //Torrent name
	Size                   int64   `json:"size"`           //Total size (bytes) of files selected for download
	Progress               float32 `json:"progress"`       //Torrent progress (percentage/100)
	Dlspeed                int64   `json:"dlspeed"`        //Torrent download speed (bytes/s)
	Upspeed                int64   `json:"upspeed"`        //Torrent upload speed (bytes/s)
	Priority               int64   `json:"priority"`       //Torrent priority. Returns -1 if queuing is disabled or torrent is in seed mode
	NumSeeds               int64   `json:"num_seeds"`      //Number of seeds connected to
	NumComplete            int64   `json:"num_complete"`   //Number of seeds in the swarm
	NumLeechs              int64   `json:"num_leechs"`     //Number of leechers connected to
	NumIncomplete          int64   `json:"num_incomplete"` //Number of leechers in the swarm
	Ratio                  float32 `json:"ratio"`          //Torrent share ratio. Max ratio value: 9999.
	Eta                    int64   `json:"eta"`            //Torrent ETA (seconds)
	State                  string  `json:"state"`          //Torrent state. See table here below for the possible values
	SeqDl                  bool    `json:"seq_dl"`         //True if sequential download is enabled
	FirstLastPiecePriority bool    `json:"f_l_piece_prio"` //True if first last piece are prioritized
	Category               string  `json:"category"`       //Category of the torrent
	SuperSeeding           bool    `json:"super_seeding"`  //True if super seeding is enabled
	ForceStart             bool    `json:"force_start"`    //True if force start is enabled for this torrent
	DateAdded              uint64  `json:"added_on"`       //Not On Wiki: Timestamp of Added Time
	DateCompleted          uint64  `json:"completion_on"`  //Not On Wiki: Timestamp of Completed Time
	LastActivity           uint64  `json:"last_activity"`  //Not On Wiki: Timestamp of LastActivity Time
}

Torrent ...

func (Torrent) Completed

func (T Torrent) Completed() bool

Completed true if Progress == 1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL