qbv1

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: GPL-3.0 Imports: 15 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 NewClientEx

func NewClientEx(baseURL string, username string, password string, debug bool) (qb *Client, err error)

NewClientEx ...

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) GetPreference

func (qb *Client) GetPreference() (*Preference, error)

GetPreference .

func (*Client) ListTorrent

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

ListTorrent ...

func (*Client) Logout

func (qb *Client) Logout() error

Logout ...

type Preference

type Preference struct {
	Locale                           string            `json:"locale,omitempty"`
	SavePath                         string            `json:"save_path,omitempty"`
	TempPathEnabled                  bool              `json:"temp_path_enabled,omitempty"`
	TempPath                         string            `json:"temp_path,omitempty"`
	ScanDirs                         map[string]string `json:"scan_dirs,omitempty"`
	ExportDirEnabled                 bool              `json:"export_dir_enabled,omitempty"`
	ExportDir                        string            `json:"export_dir,omitempty"`
	MailNotificationEnabled          bool              `json:"mail_notification_enabled,omitempty"`
	MailNotificationEmail            string            `json:"mail_notification_email,omitempty"`
	MailNotificationSMTP             string            `json:"mail_notification_smtp,omitempty"`
	MailNotificationSSLEnabled       bool              `json:"mail_notification_ssl_enabled,omitempty"`
	MailNotificationAuthEnabled      bool              `json:"mail_notification_auth_enabled,omitempty"`
	MailNotificationUsername         string            `json:"mail_notification_username,omitempty"`
	MailNotificationPassword         string            `json:"mail_notification_password,omitempty"`
	AutorunEnable                    bool              `json:"autorun_enable,omitempty"`
	AutorunProgram                   string            `json:"autorun_program,omitempty"`
	PreallocateAll                   bool              `json:"preallocate_all,omitempty"`
	QueuingEnabled                   bool              `json:"queuing_enabled,omitempty"`
	MaxActiveDownloads               int               `json:"max_active_downloads,omitempty"`
	MaxActiveTorrents                int               `json:"max_active_torrents,omitempty"`
	MaxActiveUploads                 int               `json:"max_active_uploads,omitempty"`
	DontCountSlowTorrents            bool              `json:"dont_count_slow_torrents,omitempty"`
	MaxRatioEnabled                  bool              `json:"max_ratio_enabled,omitempty"`
	MaxRatio                         float32           `json:"max_ratio,omitempty"`
	MaxRatioAct                      int               `json:"max_ratio_act,omitempty"`
	IncompleteFileExt                bool              `json:"incomplete_file_ext,omitempty"`
	ListenPort                       int               `json:"listen_port,omitempty"`
	UPNP                             bool              `json:"upnp,omitempty"`
	RandomPort                       bool              `json:"random_port,omitempty"`
	DlLimit                          int               `json:"dl_limit,omitempty"`
	UpLimit                          int               `json:"up_limit,omitempty"`
	MaxConnec                        int               `json:"max_connec,omitempty"`
	MaxConnecPerTorrent              int               `json:"max_connec_per_torrent,omitempty"`
	MaxUploads                       int               `json:"max_uploads,omitempty"`
	MaxUploadPerTorrent              int               `json:"max_upload_per_torrent,omitempty"`
	EnableUTP                        bool              `json:"enable_utp,omitempty"`
	LimitUTPRate                     bool              `json:"limit_utp_rate,omitempty"`
	LimitTCPOverhead                 bool              `json:"limit_tcp_overhead,omitempty"`
	AltDlLimit                       int               `json:"alt_dl_limit,omitempty"`
	AltUpLimit                       int               `json:"alt_up_limit,omitempty"`
	SchedulerEnabled                 bool              `json:"scheduler_enabled,omitempty"`
	ScheduleFromHour                 int               `json:"schedule_from_hour,omitempty"`
	ScheduleFromMin                  int               `json:"schedule_from_min,omitempty"`
	ScheduleToHour                   int               `json:"schedule_to_hour,omitempty"`
	ScheduleToMin                    int               `json:"schedule_to_min,omitempty"`
	SchedulerDays                    int               `json:"scheduler_days,omitempty"`
	DHT                              bool              `json:"dht,omitempty"`
	DHTSameAsBT                      bool              `json:"dht_same_as_bt,omitempty"`
	DHTPort                          int               `json:"dht_port,omitempty"`
	PEX                              bool              `json:"pex,omitempty"`
	LSD                              bool              `json:"lsd,omitempty"`
	Encryption                       int               `json:"encryption,omitempty"`
	AnonymousMode                    bool              `json:"anonymous_mode,omitempty"`
	ProxyType                        int               `json:"proxy_type,omitempty"`
	ProxyIP                          string            `json:"proxy_ip,omitempty"`
	ProxyPort                        int               `json:"proxy_port,omitempty"`
	ProxyPeerConnections             bool              `json:"proxy_peer_connections,omitempty"`
	ForceProxy                       bool              `json:"force_proxy,omitempty"`
	ProxyAuthEnabled                 bool              `json:"proxy_auth_enabled,omitempty"`
	ProxyUsername                    string            `json:"proxy_username,omitempty"`
	ProxyPassword                    string            `json:"proxy_password,omitempty"`
	IPFilterEnabled                  bool              `json:"ip_filter_enabled,omitempty"`
	IPFilterPath                     string            `json:"ip_filter_path,omitempty"`
	IPFilterTrackers                 bool              `json:"ip_filter_trackers,omitempty"`
	WebUIPort                        int               `json:"web_ui_port,omitempty"`
	WebUIUPNP                        bool              `json:"web_uiupnp,omitempty"`
	WebUIUsername                    string            `json:"web_ui_username,omitempty"`
	WebUIPassword                    string            `json:"web_ui_password,omitempty"`
	BypassLocalAuth                  bool              `json:"bypass_local_auth,omitempty"`
	BypassAuthSubnetWhitelistEnabled bool              `json:"bypass_auth_subnet_whitelist_enabled,omitempty"`
	BypassAuthSubnetWhiteList        string            `json:"bypass_auth_subnet_white_list,omitempty"`
	UseHTTPS                         bool              `json:"use_https,omitempty"`
	SSLKey                           string            `json:"ssl_key,omitempty"`
	SSLCert                          string            `json:"ssl_cert,omitempty"`
	DyndnsEnabled                    bool              `json:"dyndns_enabled,omitempty"`
	DyndnsService                    int               `json:"dyndns_service,omitempty"`
	DyndnsUsername                   string            `json:"dyndns_username,omitempty"`
	DyndnsPassword                   string            `json:"dyndns_password,omitempty"`
	DyndnsDomain                     string            `json:"dyndns_domain,omitempty"`
}

Preference .

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

type UploadOption

type UploadOption struct {
	SavePath           string //(optional) Download folder
	Cookie             string //(optional) Cookie sent to download the .torrent file
	Category           string //(optional) Category for the torrent
	SkipChecking       bool   //(optional) Skip hash checking. Possible values are true, false (default)
	Paused             bool   //(optional) Add torrents in the paused state. Possible values are true, false (default)
	RootFolder         bool   //(optional) Create the root folder. Possible values are true, false, unset (default)
	Rename             string //(optional) Rename torrent
	UploadLimit        uint64 //(optional) Set torrent upload speed limit. Unit in bytes/second
	DownloadLimit      uint64 //(optional) Set torrent download speed limit. Unit in bytes/second
	SequentialDownload bool   //(optional) Enable sequential download. Possible values are true, false (default)
	FirstLastPiecePrio bool   //(optional) Prioritize download first last piece. Possible values are true, false (default)
}

UploadOption .

Jump to

Keyboard shortcuts

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