qbittorrent

package module
v0.0.0-...-6ac5879 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

qbittorrent-webapi-go

Golang wrapper for qBittorrent Web API (for versions above v4.1+).

This wrapper is based on the methods described in qBittorrent WebUI API wiki

Installation

go get github.com/alabsi91/qbittorrent-webapi-go

Quick Guide

package main

import (
    "fmt"

    "github.com/alabsi91/qbittorrent-webapi-go"
)

func main() {
    // First create the client
    client := qbittorrent.NewClient("http://localhost:8080")

    // Login
    err := client.Login("admin", "adminadmin")
    if err != nil {
        panic(err)
    }

    // Get torrents
    options := &qbittorrent.GetTorrentListOptions{
        Filter: qbittorrent.FilterAll,
    }
    torrents, err := client.GetTorrentList(options)
    if err != nil {
        panic(err)
    }

    for _, torrent := range torrents {
        fmt.Printf("%+v\n", torrent.Name)
    }
}
Using builders

The following methods has parameters builders.

  • SetApplicationPreferences
  • AddNewTorrent
  • SetRSSAutoDownloadingRule
func main() {
    client := qbittorrent.NewClient("http://localhost:8080")

    // login
    err := client.Login("admin", "adminadmin")
    if err != nil {
        panic(err)
    }

    // set preferences
    params := qbittorrent.NewPreferences().
        Locale("en").
        SavePath("/home/user/Downloads")

    err = client.SetApplicationPreferences(params.Data)
    if err != nil {
        panic(err)
    }

    // Add torrent
	torrent := qbittorrent.NewTorrent().
		AddUrl("URL: http://, https://, magnet: and bc://bt/ links are supported").
		AddUrl("Additional URL").
		AddFromFile("pathToTorrentFile.torrent").
		AddFromFile("AdditionalPathToTorrentFile.torrent").
		Category("Movies").
		AutoTMM(true)

	err = client.AddNewTorrent(torrent.Data)
	if err != nil {
		panic(err)
	}
}

Methods

Authentication
  • Login(username, password string) (err error)
  • Logout() (err error)
Application
  • GetApplicationVersion() (version string, err error)
  • GetAPIVersion() (version string, err error)
  • GetBuildInfo() (info BuildInfo, err error)
  • ShutdownApplication() (err error)
  • GetApplicationPreferences() (resultsApplicationPreferences, err error)
  • SetApplicationPreferences(prefs *map[string]interfac{}) (err error)
  • GetDefaultSavePath() (path string, err error)
Log
  • GetLog(params *GetLogParams) (results []GetLogResponse, err error)
  • GetPeerLog(lastKnownId int) (results []GetPeerLogResponse, err error)
Sync
  • GetSyncMainData(rid int) (results SyncMainDataResponse, err error)
  • GetSyncTorrentPeersData(hash string, rid int) (results map[string]interface{}, err error)
Transfer Info
  • GetGlobalTransferInfo() (results TransferInfoResponse, err error)
  • GetAlternativeSpeedLimitsState() (results AlternativeSpeedLimitsStatus, err error)
  • ToggleAlternativeSpeedLimits() (err error)
  • GetGlobalDownloadLimit() (results int, err error)
  • SetGlobalDownloadLimit(limit int) (err error)
  • GetGlobalUploadLimit() (results int, err error)
  • SetGlobalUploadLimit(limit int) (err error)
  • BanPeers(peers []string) (err error)
Torrent Management
  • GetTorrentList(opts *GetTorrentListOptions) (results []TorrentListResponse, err error)
  • GetTorrentGenericProperties(hash string) (results TorrentGenericProperties, err error)
  • GetTorrentTrackers(hash string) (results []TorrentTracker, err error)
  • GetTorrentWebSeeds(hash string) (results []TorrentSeed, err error)
  • GetTorrentContents(hash string, indexes ...int) (results []TorrentFile, err error)
  • GetTorrentPiecesStates(hash string) (results []TorrentPiecesState, err error)
  • GetTorrentPiecesHashes(hash string) (results []string, err error)
  • PauseTorrents(hashes []string) (err error)
  • ResumeTorrents(hashes []string) (err error)
  • DeleteTorrents(hashes []string, deleteFiles bool) (err error)
  • RecheckTorrents(hashes []string) (err error)
  • ReannounceTorrents(hashes []string) (err error)
  • AddNewTorrent(formData map[string]string) (err error)
  • AddTrackersToTorrent(hash string, trackers []string) (err error)
  • EditTrackers(hash, origUrl, newUrl string) (err error)
  • RemoveTrackers(hash string, urls []string) (err error)
  • AddPeers(hashes, peers []string)
  • IncreaseTorrentPriority(hashes []string) (err error)
  • DecreaseTorrentPriority(hashes []string) (err error)
  • MaximalTorrentPriority(hashes []string) (err error)
  • MinimalTorrentPriority(hashes []string) (err error)
  • SetFilePriority(hash string, ids []string, priority FilePriority) (err error)
  • GetTorrentDownloadLimit(hashes []string) (results map[string]int, err error)
  • SetTorrentDownloadLimit(hashes []string, limit int) (err error)
  • SetTorrentShareLimit(hashes []string, ratioLimit float64, seedingTimeLimit, inactiveSeedingTimeLimit int) (err error)
  • GetTorrentUploadLimit(hashes []string) (results map[string]int, err error)
  • SetTorrentUploadLimit(hashes []string, limit int) (err error)
  • SetTorrentLocation(hashes []string, location string) (err error)
  • SetTorrentName(hash, name string) (err error)
  • SetTorrentCategory(hashes []string, category string) (err error)
  • GetAllCategories() (results map[string]Category, err error)
  • AddNewCategory(name, savePath string) (err error)
  • EditCategory(name, savePath string) (err error)
  • RemoveCategories(categories []string) (err error)
  • AddTorrentTags(hashes, tags []string) (err error)
  • RemoveTorrentTags(hashes, tags []string) (err error)
  • GetAllTags() (results []string, err error)
  • CreateTags(tags []string) (err error)
  • DeleteTags(tags []string) (err error)
  • SetAutomaticTorrentManagement(hashes []string, enable bool) (err error)
  • ToggleSequentialDownload(hashes []string) (err error)
  • ToggleFirstLastPiecePriority(hashes []string) (err error)
  • SetForceStart(hashes []string, enable bool) (err error)
  • SetSuperSeeding(hashes []string, enable bool) (err error)
  • RenameFile(hash, oldPath, newPath string) (err error)
  • RenameFolder(hash, oldPath, newPath string) (err error)
RSS
  • AddRSSFolder(path string) (err error)
  • AddRSSFeed(feedUrl, path string) (err error)
  • RemoveRSSItem(path string) (err error)
  • MoveRSSItem(itemPath, destPath string) (err error)
  • GetAllRSSItems(withData bool) (results map[string]interface{}, err error)
  • MarkRSSAsRead(itemPath, articleId string) (err error)
  • RefreshRSSItem(itemPath string) (err error)
  • SetRSSAutoDownloadingRule(ruleName string, ruleDef map[string]interface{}) (err error)
  • RenameRSSAutoDownloadingRule(ruleName, newRuleName string) (err error)
  • RemoveRSSAutoDownloadingRule(ruleName string) (err error)
  • GetAllRSSDownloadingRules() (results map[string]RSSDownloadingRule, err error)
  • GetAllRSSArticlesMatchingRule(ruleName string) (results map[string][]string, err error)
  • StartSearch(pattern string, plugins []string, category []string) (results int, err error)
  • StopSearch(id int) (err error)
  • GetSearchStatus(id *int) (results []SearchStatusResponse, err error)
  • GetSearchResults(id int, limit, offset *int) (results SearchResultsResponse, err error)
  • DeleteSearch(id int) (err error)
  • GetSearchPlugins() (results []SearchPluginsResponse, err error)
  • InstallSearchPlugin(sources []string) (err error)
  • UninstallSearchPlugin(names []string) (err error)
  • EnableSearchPlugin(names []string, enable bool) (err error)
  • UpdateSearchPlugins() (err error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlternativeSpeedLimitsStatus

type AlternativeSpeedLimitsStatus int
const (
	AlternativeSpeedLimitsDisabled AlternativeSpeedLimitsStatus = 0
	AlternativeSpeedLimitsEnabled  AlternativeSpeedLimitsStatus = 1
)

type ApplicationPreferences

type ApplicationPreferences struct {
	Locale                             string                 `json:"locale"`                                 // Currently selected language (e.g. en_GB for English)
	CreateSubfolderEnabled             bool                   `json:"create_subfolder_enabled"`               // True if a subfolder should be created when adding a torrent
	StartPausedEnabled                 bool                   `json:"start_paused_enabled"`                   // True if torrents should be added in a Paused state
	AutoDeleteMode                     int                    `json:"auto_delete_mode"`                       // TODO
	PreallocateAll                     bool                   `json:"preallocate_all"`                        // True if disk space should be pre-allocated for all files
	IncompleteFilesExt                 bool                   `json:"incomplete_files_ext"`                   // True if ".!qB" should be appended to incomplete files
	AutoTmmEnabled                     bool                   `json:"auto_tmm_enabled"`                       // True if Automatic Torrent Management is enabled by default
	TorrentChangedTmmEnabled           bool                   `json:"torrent_changed_tmm_enabled"`            // True if torrent should be relocated when its Category changes
	SavePathChangedTmmEnabled          bool                   `json:"save_path_changed_tmm_enabled"`          // True if torrent should be relocated when the default save path changes
	CategoryChangedTmmEnabled          bool                   `json:"category_changed_tmm_enabled"`           // True if torrent should be relocated when its Category's save path changes
	SavePath                           string                 `json:"save_path"`                              // Default save path for torrents, separated by slashes
	TempPathEnabled                    bool                   `json:"temp_path_enabled"`                      // True if folder for incomplete torrents is enabled
	TempPath                           string                 `json:"temp_path"`                              // Path for incomplete torrents, separated by slashes
	ScanDirs                           map[string]interface{} `json:"scan_dirs"`                              // Property: directory to watch for torrent files, value: where torrents loaded from this directory should be downloaded to. Slashes are used as path separators; multiple key/value pairs can be specified Possible values of scan_dirs - `0` Download to the monitored folder - `1` Download to the default save path - "/path/to/download/to"	Download to this path
	ExportDir                          string                 `json:"export_dir"`                             // Path to directory to copy .torrent files to. Slashes are used as path separators
	ExportDirFin                       string                 `json:"export_dir_fin"`                         // Path to directory to copy .torrent files of completed downloads to. Slashes are used as path separators
	MailNotificationEnabled            bool                   `json:"mail_notification_enabled"`              // True if e-mail notification should be enabled
	MailNotificationSender             string                 `json:"mail_notification_sender"`               // e-mail where notifications should originate from
	MailNotificationEmail              string                 `json:"mail_notification_email"`                // e-mail to send notifications to
	MailNotificationSmtp               string                 `json:"mail_notification_smtp"`                 // smtp server for e-mail notifications
	MailNotificationSslEnabled         bool                   `json:"mail_notification_ssl_enabled"`          // True if smtp server requires SSL connection
	MailNotificationAuthEnabled        bool                   `json:"mail_notification_auth_enabled"`         // True if smtp server requires authentication
	MailNotificationUsername           string                 `json:"mail_notification_username"`             // Username for smtp authentication
	MailNotificationPassword           string                 `json:"mail_notification_password"`             // Password for smtp authentication
	AutorunEnabled                     bool                   `json:"autorun_enabled"`                        // True if external program should be run after torrent has finished downloading
	AutorunProgram                     string                 `json:"autorun_program"`                        // Program path/name/arguments to run if autorun_enabled is enabled; path is separated by slashes; you can use %f and %n arguments, which will be expanded by qBittorent as path_to_torrent_file and torrent_name (from the GUI; not the .torrent file name) respectively
	QueueingEnabled                    bool                   `json:"queueing_enabled"`                       // True if torrent queuing is enabled
	MaxActiveDownloads                 int                    `json:"max_active_downloads"`                   // Maximum number of active simultaneous downloads
	MaxActiveTorrents                  int                    `json:"max_active_torrents"`                    // Maximum number of active simultaneous downloads and uploads
	MaxActiveUploads                   int                    `json:"max_active_uploads"`                     // Maximum number of active simultaneous uploads
	DontCountSlowTorrents              bool                   `json:"dont_count_slow_torrents"`               // If true torrents w/o any activity (stalled ones) will not be counted towards max_active_* limits; see dont_count_slow_torrents for more information
	SlowTorrentDlRateThreshold         int                    `json:"slow_torrent_dl_rate_threshold"`         // Download rate in KiB/s for a torrent to be considered "slow"
	SlowTorrentUlRateThreshold         int                    `json:"slow_torrent_ul_rate_threshold"`         // Upload rate in KiB/s for a torrent to be considered "slow"
	SlowTorrentInactiveTimer           int                    `json:"slow_torrent_inactive_timer"`            // Seconds a torrent should be inactive before considered "slow"
	MaxRatioEnabled                    bool                   `json:"max_ratio_enabled"`                      // True if share ratio limit is enabled
	MaxRatio                           float64                `json:"max_ratio"`                              // Get the global share ratio limit
	MaxRatioAct                        DyndnsService          `json:"max_ratio_act"`                          // Action performed when a torrent reaches the maximum share ratio. See list of possible values here below.
	ListenPort                         int                    `json:"listen_port"`                            // Port for incoming connections
	Upnp                               bool                   `json:"upnp"`                                   // True if UPnP/NAT-PMP is enabled
	RandomPort                         bool                   `json:"random_port"`                            // True if the port is randomly selected
	DlLimit                            int                    `json:"dl_limit"`                               // Global download speed limit in KiB/s; -1 means no limit is applied
	UpLimit                            int                    `json:"up_limit"`                               // Global upload speed limit in KiB/s; -1 means no limit is applied
	MaxConnec                          int                    `json:"max_connec"`                             // Maximum global number of simultaneous connections
	MaxConnecPerTorrent                int                    `json:"max_connec_per_torrent"`                 // Maximum number of simultaneous connections per torrent
	MaxUploads                         int                    `json:"max_uploads"`                            // Maximum number of upload slots
	MaxUploadsPerTorrent               int                    `json:"max_uploads_per_torrent"`                // Maximum number of upload slots per torrent
	StopTrackerTimeout                 int                    `json:"stop_tracker_timeout"`                   // Timeout in seconds for a stopped announce request to trackers
	EnablePieceExtentAffinity          bool                   `json:"enable_piece_extent_affinity"`           // True if the advanced libtorrent option piece_extent_affinity is enabled
	BittorrentProtocol                 BittorrentProtocol     `json:"bittorrent_protocol"`                    // Bittorrent Protocol to use
	LimitUtpRate                       bool                   `json:"limit_utp_rate"`                         // True if [du]l_limit should be applied to uTP connections; this option is only available in qBittorent built against libtorrent version 0.16.X and higher
	LimitTcpOverhead                   bool                   `json:"limit_tcp_overhead"`                     // True if [du]l_limit should be applied to estimated TCP overhead (service data: e.g. packet headers)
	LimitLanPeers                      bool                   `json:"limit_lan_peers"`                        // True if [du]l_limit should be applied to peers on the LAN
	AltDlLimit                         int                    `json:"alt_dl_limit"`                           // Alternative global download speed limit in KiB/s
	AltUpLimit                         int                    `json:"alt_up_limit"`                           // Alternative global upload speed limit in KiB/s
	SchedulerEnabled                   bool                   `json:"scheduler_enabled"`                      // True if alternative limits should be applied according to schedule
	ScheduleFromHour                   int                    `json:"schedule_from_hour"`                     // Scheduler starting hour
	ScheduleFromMin                    int                    `json:"schedule_from_min"`                      // Scheduler starting minute
	ScheduleToHour                     int                    `json:"schedule_to_hour"`                       // Scheduler ending hour
	ScheduleToMin                      int                    `json:"schedule_to_min"`                        // Scheduler ending minute
	SchedulerDays                      SchedulerDays          `json:"scheduler_days"`                         // Scheduler days. See possible values here below
	Dht                                bool                   `json:"dht"`                                    // True if DHT is enabled
	Pex                                bool                   `json:"pex"`                                    // True if PeX is enabled
	Lsd                                bool                   `json:"lsd"`                                    // True if LSD is enabled
	Encryption                         Encryption             `json:"encryption"`                             // See list of possible values here below
	AnonymousMode                      bool                   `json:"anonymous_mode"`                         // If true anonymous mode will be enabled; read more here; this option is only available in qBittorent built against libtorrent version 0.16.X and higher
	ProxyType                          int                    `json:"proxy_type"`                             // See list of possible values here below
	ProxyIp                            string                 `json:"proxy_ip"`                               // Proxy IP address or domain name
	ProxyPort                          int                    `json:"proxy_port"`                             // Proxy port
	ProxyPeerConnections               bool                   `json:"proxy_peer_connections"`                 // True if peer and web seed connections should be proxified; this option will have any effect only in qBittorent built against libtorrent version 0.16.X and higher
	ProxyAuthEnabled                   bool                   `json:"proxy_auth_enabled"`                     // True proxy requires authentication; doesn't apply to SOCKS4 proxies
	ProxyUsername                      string                 `json:"proxy_username"`                         // Username for proxy authentication
	ProxyPassword                      string                 `json:"proxy_password"`                         // Password for proxy authentication
	ProxyTorrentsOnly                  bool                   `json:"proxy_torrents_only"`                    // True if proxy is only used for torrents
	IpFilterEnabled                    bool                   `json:"ip_filter_enabled"`                      // True if external IP filter should be enabled
	IpFilterPath                       string                 `json:"ip_filter_path"`                         // Path to IP filter file (.dat, .p2p, .p2b files are supported); path is separated by slashes
	IpFilterTrackers                   bool                   `json:"ip_filter_trackers"`                     // True if IP filters are applied to trackers
	WebUiDomainList                    string                 `json:"web_ui_domain_list"`                     // Semicolon-separated list of domains to accept when performing Host header validation
	WebUiAddress                       string                 `json:"web_ui_address"`                         // IP address to use for the WebUI
	WebUiPort                          int                    `json:"web_ui_port"`                            // WebUI port
	WebUiUpnp                          bool                   `json:"web_ui_upnp"`                            // True if UPnP is used for the WebUI port
	WebUiUsername                      string                 `json:"web_ui_username"`                        // WebUI username
	WebUiPassword                      string                 `json:"web_ui_password"`                        // For API ≥ v2.3.0: Plaintext WebUI password, not readable, write-only. For API < v2.3.0: MD5 hash of WebUI password, hash is generated from the following string: username:Web UI Access:plain_text_web_ui_password
	WebUiCsrfProtectionEnabled         bool                   `json:"web_ui_csrf_protection_enabled"`         // True if WebUI CSRF protection is enabled
	WebUiClickjackingProtectionEnabled bool                   `json:"web_ui_clickjacking_protection_enabled"` // True if WebUI clickjacking protection is enabled
	WebUiSecureCookieEnabled           bool                   `json:"web_ui_secure_cookie_enabled"`           // True if WebUI cookie Secure flag is enabled
	WebUiMaxAuthFailCount              int                    `json:"web_ui_max_auth_fail_count"`             // Maximum number of authentication failures before WebUI access ban
	WebUiBanDuration                   int                    `json:"web_ui_ban_duration"`                    // WebUI access ban duration in seconds
	WebUiSessionTimeout                int                    `json:"web_ui_session_timeout"`                 // Seconds until WebUI is automatically signed off
	WebUiHostHeaderValidationEnabled   bool                   `json:"web_ui_host_header_validation_enabled"`  // True if WebUI host header validation is enabled
	BypassLocalAuth                    bool                   `json:"bypass_local_auth"`                      // True if authentication challenge for loopback address (127.0.0.1) should be disabled
	BypassAuthSubnetWhitelistEnabled   bool                   `json:"bypass_auth_subnet_whitelist_enabled"`   // True if webui authentication should be bypassed for clients whose ip resides within (at least) one of the subnets on the whitelist
	BypassAuthSubnetWhitelist          string                 `json:"bypass_auth_subnet_whitelist"`           // (White)list of ipv4/ipv6 subnets for which webui authentication should be bypassed; list entries are separated by commas
	AlternativeWebuiEnabled            bool                   `json:"alternative_webui_enabled"`              // True if an alternative WebUI should be used
	AlternativeWebuiPath               string                 `json:"alternative_webui_path"`                 // File path to the alternative WebUI
	UseHttps                           bool                   `json:"use_https"`                              // True if WebUI HTTPS access is enabled
	SslKey                             string                 `json:"ssl_key"`                                // For API < v2.0.1: SSL keyfile contents (this is a not a path)
	SslCert                            string                 `json:"ssl_cert"`                               // For API < v2.0.1: SSL certificate contents (this is a not a path)
	WebUiHttpsKeyPath                  string                 `json:"web_ui_https_key_path"`                  // For API ≥ v2.0.1: Path to SSL keyfile
	WebUiHttpsCertPath                 string                 `json:"web_ui_https_cert_path"`                 // For API ≥ v2.0.1: Path to SSL certificate
	DyndnsEnabled                      bool                   `json:"dyndns_enabled"`                         // True if server DNS should be updated dynamically
	DyndnsService                      DyndnsService          `json:"dyndns_service"`                         // See list of possible values here below
	DyndnsUsername                     string                 `json:"dyndns_username"`                        // Username for DDNS service
	DyndnsPassword                     string                 `json:"dyndns_password"`                        // Password for DDNS service
	DyndnsDomain                       string                 `json:"dyndns_domain"`                          // Your DDNS domain name
	RssRefreshInterval                 int                    `json:"rss_refresh_interval"`                   // RSS refresh interval
	RssMaxArticlesPerFeed              int                    `json:"rss_max_articles_per_feed"`              // Max stored articles per RSS feed
	RssProcessingEnabled               bool                   `json:"rss_processing_enabled"`                 // Enable processing of RSS feeds
	RssAutoDownloadingEnabled          bool                   `json:"rss_auto_downloading_enabled"`           // Enable auto-downloading of torrents from the RSS feeds
	RssDownloadRepackProperEpisodes    bool                   `json:"rss_download_repack_proper_episodes"`    // For API ≥ v2.5.1: Enable downloading of repack/proper Episodes
	RssSmartEpisodeFilters             string                 `json:"rss_smart_episode_filters"`              // For API ≥ v2.5.1: List of RSS Smart Episode Filters
	AddTrackersEnabled                 bool                   `json:"add_trackers_enabled"`                   // Enable automatic adding of trackers to new torrents
	AddTrackers                        string                 `json:"add_trackers"`                           // List of trackers to add to new torrent
	WebUiUseCustomHttpHeadersEnabled   bool                   `json:"web_ui_use_custom_http_headers_enabled"` // For API ≥ v2.5.1: Enable custom http headers
	WebUiCustomHttpHeaders             string                 `json:"web_ui_custom_http_headers"`             // For API ≥ v2.5.1: List of custom http headers
	MaxSeedingTimeEnabled              bool                   `json:"max_seeding_time_enabled"`               // True enables max seeding time
	MaxSeedingTime                     int                    `json:"max_seeding_time"`                       // Number of minutes to seed a torrent
	AnnounceIp                         string                 `json:"announce_ip"`                            // TODO
	AnnounceToAllTiers                 bool                   `json:"announce_to_all_tiers"`                  // True always announce to all tiers
	AnnounceToAllTrackers              bool                   `json:"announce_to_all_trackers"`               // True always announce to all trackers in a tier
	AsyncIoThreads                     int                    `json:"async_io_threads"`                       // Number of asynchronous I/O threads
	BannedIPs                          string                 `json:"banned_IPs"`                             // List of banned IPs
	CheckingMemoryUse                  int                    `json:"checking_memory_use"`                    // Outstanding memory when checking torrents in MiB
	CurrentInterfaceAddress            string                 `json:"current_interface_address"`              // IP Address to bind to. Empty String means All addresses
	CurrentNetworkInterface            string                 `json:"current_network_interface"`              // Network Interface used
	DiskCache                          int                    `json:"disk_cache"`                             // Disk cache used in MiB
	DiskCacheTtl                       int                    `json:"disk_cache_ttl"`                         // Disk cache expiry interval in seconds
	EmbeddedTrackerPort                int                    `json:"embedded_tracker_port"`                  // Port used for embedded tracker
	EnableCoalesceReadWrite            bool                   `json:"enable_coalesce_read_write"`             // True enables coalesce reads & writes
	EnableEmbeddedTracker              bool                   `json:"enable_embedded_tracker"`                // True enables embedded tracker
	EnableMultiConnectionsFromSameIP   bool                   `json:"enable_multi_connections_from_same_ip"`  // True allows multiple connections from the same IP address
	EnableOsCache                      bool                   `json:"enable_os_cache"`                        // True enables os cache
	EnableUploadSuggestions            bool                   `json:"enable_upload_suggestions"`              // True enables sending of upload piece suggestions
	FilePoolSize                       int                    `json:"file_pool_size"`                         // File pool size
	OutgoingPortsMax                   int                    `json:"outgoing_ports_max"`                     // Maximal outgoing port (0: Disabled)
	OutgoingPortsMin                   int                    `json:"outgoing_ports_min"`                     // Minimal outgoing port (0: Disabled)
	RecheckCompletedTorrents           bool                   `json:"recheck_completed_torrents"`             // True rechecks torrents on completion
	ResolvePeerCountries               bool                   `json:"resolve_peer_countries"`                 // True resolves peer countries
	SaveResumeDataInterval             int                    `json:"save_resume_data_interval"`              // Save resume data interval in min
	SendBufferLowWatermark             int                    `json:"send_buffer_low_watermark"`              // Send buffer low watermark in KiB
	SendBufferWatermark                int                    `json:"send_buffer_watermark"`                  // Send buffer watermark in KiB
	SendBufferWatermarkFactor          int                    `json:"send_buffer_watermark_factor"`           // Send buffer watermark factor in percent
	SocketBacklogSize                  int                    `json:"socket_backlog_size"`                    // Socket backlog size
	UploadChokingAlgorithm             UploadChokingAlgorithm `json:"upload_choking_algorithm"`               // Upload choking algorithm used
	UploadSlotsBehavior                UploadSlotsBehavior    `json:"upload_slots_behavior"`                  // Upload slots behavior used
	UpnpLeaseDuration                  int                    `json:"upnp_lease_duration"`                    // UPnP lease duration (0: Permanent lease)
	UtpTcpMixedMode                    UtpTcpMixedMode        `json:"utp_tcp_mixed_mode"`                     // μTP-TCP mixed mode algorithm
}

type BittorrentProtocol

type BittorrentProtocol int
const (
	BittorrentProtocolBoth BittorrentProtocol = 0 // TCP and μTP
	BittorrentProtocolTCP  BittorrentProtocol = 1 // Only TCP
	BittorrentProtocolUTP  BittorrentProtocol = 2 // Only μTP
)

type BuildInfo

type BuildInfo struct {
	QT         string `json:"qt"`         // QT version
	LibTorrent string `json:"libtorrent"` // libtorrent version
	Boost      string `json:"boost"`      // Boost version
	OpenSSL    string `json:"openssl"`    // OpenSSL version
	Bitness    int    `json:"bitness"`    // Application bitness (e.g. 64-bit)
}

type Category

type Category struct {
	Name     string `json:"name"`
	SavePath string `json:"savePath"`
}

type Client

type Client struct {
	ServerURL string

	Jar http.CookieJar
	// contains filtered or unexported fields
}

func NewClient

func NewClient(serverURL string) *Client

func (*Client) AddNewCategory

func (c *Client) AddNewCategory(name, savePath string) (err error)

Adds a new category to the client

Params

  • "name" The name of the new category
  • "savePath" The path of the new category

Http Error Codes

  • 400 Category name is empty
  • 409 Category name is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-new-category

func (*Client) AddNewTorrent

func (c *Client) AddNewTorrent(formData map[string]string) (err error)

This method can add torrents from a local file or from URLs. http://, https://, magnet: and bc://bt/ links are supported.

Params

  • "formData" a map of key value pairs, where the key is the name of the form field and the value is the value of the form field

Example

torrent := qbittorrent.NewTorrent().
	AddUrl("URL: http://, https://, magnet: and bc://bt/ links are supported").
	AddUrl("Additional URL").
	AddFromFile("pathToTorrentFile.torrent").
	AddFromFile("AdditionalPathToTorrentFile.torrent").
	Category("Movies").
	AutoTMM(true)

err = client.AddNewTorrent(torrent.Data)
if err != nil {
	panic(err)
}

Http Error Codes

  • 415 Torrent file is not valid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-new-torrent

func (*Client) AddPeers

func (c *Client) AddPeers(hashes, peers []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to add peers to
  • "peers" The peers to add, Each peer is a colon-separated host:port

Http Error Codes

  • 400 None of the supplied peers are valid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-peers

func (*Client) AddRSSFeed

func (c *Client) AddRSSFeed(feedUrl, path string) (err error)

Params

Http Error Codes

  • 409 Failure to add feed
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-feed

func (*Client) AddRSSFolder

func (c *Client) AddRSSFolder(path string) (err error)

Params

  • "path" Full path of added folder (e.g. "The Pirate Bay\Top100")

Http Error Codes

  • 409 Failure to add folder
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-folder

func (*Client) AddTorrentTags

func (c *Client) AddTorrentTags(hashes, tags []string) (err error)

Adds tags to torrents

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to add tags. or set to []string{"all"}, to add tags to all torrents.
  • "tags" The tags to add

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-torrent-tags

func (*Client) AddTrackersToTorrent

func (c *Client) AddTrackersToTorrent(hash string, trackers []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to add trackers to.
  • "urls" The URLs of the trackers you want to add.

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-trackers-to-torrent

func (*Client) BanPeers

func (c *Client) BanPeers(peers []string) (err error)

Params

  • "peers" The list of peers to ban

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#ban-peers

func (*Client) CreateTags

func (c *Client) CreateTags(tags []string) (err error)

Creates new tags in the client

Params

  • "tags" The tags to create

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#create-tags

func (*Client) DecreaseTorrentPriority

func (c *Client) DecreaseTorrentPriority(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to decrease the priority of. or set to []string{"all"}, to decrease the priority of all torrents.

Http Error Codes

  • 409 Torrent queueing is not enabled
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#decrease-torrent-priority

func (*Client) DeleteSearch

func (c *Client) DeleteSearch(id int) (err error)

Params

  • "id" ID of the search job

Http Error Codes

  • 404 Search job was not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-search

func (*Client) DeleteTags

func (c *Client) DeleteTags(tags []string) (err error)

Deletes tags from the client

Params

  • "tags" The tags to delete

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-tags

func (*Client) DeleteTorrents

func (c *Client) DeleteTorrents(hashes []string, deleteFiles bool) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to delete. or set to []string{"all"}, to resume all torrents.
  • "deleteFiles" If set to true, the downloaded data will also be deleted, otherwise has no effect.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-torrents

func (*Client) EditCategory

func (c *Client) EditCategory(name, savePath string) (err error)

Edits an existing category in the client

Params

  • "name" The name of the category to edit
  • "savePath" The new path of the category

Http Error Codes

  • 400 Category name is empty
  • 409 Category editing failed
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#edit-category

func (*Client) EditTrackers

func (c *Client) EditTrackers(hash, origUrl, newUrl string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to edit trackers for.
  • "origUrl" The tracker URL you want to edit.
  • "newUrl" The new tracker URL to replace the "origUrl"

Http Error Codes

  • 400 newUrl is not a valid URL
  • 404 Torrent hash was not found
  • 409 newUrl already exists for the torrent
  • 409 origUrl was not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#edit-trackers

func (*Client) EnableSearchPlugin

func (c *Client) EnableSearchPlugin(names []string, enable bool) (err error)

Params

  • "names" Name of the plugin to enable/disable (e.g. "legittorrents").
  • "enable" Whether the plugins should be enabled

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#enable-search-plugin

func (*Client) GetAPIVersion

func (c *Client) GetAPIVersion() (version string, err error)

The response is a string with the WebAPI version, e.g. 2.0

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-api-version

func (*Client) GetAllCategories

func (c *Client) GetAllCategories() (results map[string]Category, err error)

Returns all categories in the client

map["Movies":{"Movies" "/media/Plex/Movies"} "TV Shows":{"TV Shows" "/media/Plex/TV Shows"}]

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-categories

func (*Client) GetAllRSSArticlesMatchingRule

func (c *Client) GetAllRSSArticlesMatchingRule(ruleName string) (results map[string][]string, err error)

Returns all articles that match a rule by feed name

Params

  • "ruleName" Name of rule

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-articles-matching-a-rule

func (*Client) GetAllRSSDownloadingRules

func (c *Client) GetAllRSSDownloadingRules() (results map[string]RSSDownloadingRule, err error)

Returns all auto-downloading rules

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-auto-downloading-rules

func (*Client) GetAllRSSItems

func (c *Client) GetAllRSSItems(withData bool) (results map[string]interface{}, err error)

Params

  • "withData" True if you need current feed articles

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-items

func (*Client) GetAllTags

func (c *Client) GetAllTags() (results []string, err error)

Returns all tags

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-tags

func (*Client) GetAlternativeSpeedLimitsState

func (c *Client) GetAlternativeSpeedLimitsState() (results AlternativeSpeedLimitsStatus, err error)

Returns

  • The response is `1` if alternative speed limits are enabled, `0` otherwise.

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-alternative-speed-limits-state

func (*Client) GetApplicationPreferences

func (c *Client) GetApplicationPreferences() (results ApplicationPreferences, err error)

Returns the application's settings. The contents may vary depending on which settings are present in qBittorrent.ini.

# Http Error Codes: - 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-application-preferences

func (*Client) GetApplicationVersion

func (c *Client) GetApplicationVersion() (version string, err error)

The response is a string with the application version, e.g. v4.1.3

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-application-version

func (*Client) GetBuildInfo

func (c *Client) GetBuildInfo() (info BuildInfo, err error)

The response is a BuildInfo struct

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-build-info

func (*Client) GetDefaultSavePath

func (c *Client) GetDefaultSavePath() (path string, err error)

The response is a string with the default save path, e.g. C:/Users/Dayman/Downloads

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-default-save-path

func (*Client) GetGlobalDownloadLimit

func (c *Client) GetGlobalDownloadLimit() (results int, err error)

Returns

  • the value of current global download speed limit in bytes/second; this value will be zero if no limit is applied.

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-global-download-limit

func (*Client) GetGlobalTransferInfo

func (c *Client) GetGlobalTransferInfo() (results TransferInfoResponse, err error)

This method returns info you usually see in qBt status bar.

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-global-transfer-info

func (*Client) GetGlobalUploadLimit

func (c *Client) GetGlobalUploadLimit() (results int, err error)

Returns

  • the value of current global upload speed limit in bytes/second; this value will be zero if no limit is applied.

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-global-upload-limit

func (*Client) GetLog

func (c *Client) GetLog(params *GetLogParams) (results []GetLogResponse, err error)

Params [GetLogParams] struct

  • "Normal" Include normal messages (default: true)
  • "Info" Include info messages (default: true)
  • "Warning" Include warning messages (default: true)
  • "Critical" Include critical messages (default: true)
  • "LastKnownId" integer Exclude messages with "message id" <= last_known_id (default: -1)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-log

func (*Client) GetPeerLog

func (c *Client) GetPeerLog(lastKnownId int) (results []GetPeerLogResponse, err error)

Params

  • "lastKnownId" Exclude messages with "message id" <= last_known_id (default: -1)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-peer-log

func (*Client) GetSearchPlugins

func (c *Client) GetSearchPlugins() (results []SearchPluginsResponse, err error)

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-search-plugins

func (*Client) GetSearchResults

func (c *Client) GetSearchResults(id int, limit, offset *int) (results SearchResultsResponse, err error)

Params

  • "id" ID of the search job
  • "limit" (optional) max number of results to return. 0 or negative means no limit
  • "offset" (optional) result to start at. A negative number means count backwards (e.g. -2 returns the 2 most recent results)

Http Error Codes

  • 404 Search job was not found
  • 409 Offset is too large, or too small (e.g. absolute value of negative number is greater than # results)
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-search-results

func (*Client) GetSearchStatus

func (c *Client) GetSearchStatus(id *int) (results []SearchStatusResponse, err error)

Params

  • "id" (optional) ID of the search job. If not specified, all search jobs are returned

Http Error Codes

  • 404 Search job was not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-search-status

func (*Client) GetSyncMainData

func (c *Client) GetSyncMainData(rid int) (results SyncMainDataResponse, err error)

Params

  • "rid" Response ID. If not provided, rid=0 will be assumed. If the given rid is different from the one of last server reply, full_update will be true (see the server reply details for more info)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-main-data

func (*Client) GetSyncTorrentPeersData

func (c *Client) GetSyncTorrentPeersData(hash string, rid int) (results map[string]interface{}, err error)

Params

  • "hash" Torrent hash
  • "rid" Response ID. If not provided, rid=0 will be assumed. If the given rid is different from the one of last server reply, full_update will be true (see the server reply details for more info)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-peers-data

func (*Client) GetTorrentContents

func (c *Client) GetTorrentContents(hash string, indexes ...int) (results []TorrentFile, err error)

Get a list of the files of a torrent

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the contents of
  • "indexes" (optional) The indexes of the files you want to retrieve.

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-contents

func (*Client) GetTorrentDownloadLimit

func (c *Client) GetTorrentDownloadLimit(hashes []string) (results map[string]int, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to get the download limit of. or set to []string{"all"}, to get the download limit of all torrents.

Returns:

  • map[string]int where key is the torrent hash and value is the download speed limit in bytes per second; this value will be zero if no limit is applied.

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-download-limit

func (*Client) GetTorrentGenericProperties

func (c *Client) GetTorrentGenericProperties(hash string) (results TorrentGenericProperties, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the generic properties of

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

NB

  • `-1` is returned if the type of the property is integer but its value is not known.

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-generic-properties

func (*Client) GetTorrentList

func (c *Client) GetTorrentList(opts *GetTorrentListOptions) (results []TorrentListResponse, err error)

GetTorrentList - get list of torrents in the client

Params

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-list

func (*Client) GetTorrentPiecesHashes

func (c *Client) GetTorrentPiecesHashes(hash string) (results []string, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the pieces' hashes of

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-pieces-hashes

func (*Client) GetTorrentPiecesStates

func (c *Client) GetTorrentPiecesStates(hash string) (results []TorrentPiecesState, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the pieces' states of

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-pieces-states

func (*Client) GetTorrentTrackers

func (c *Client) GetTorrentTrackers(hash string) (results []TorrentTracker, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the generic properties of

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-trackers

func (*Client) GetTorrentUploadLimit

func (c *Client) GetTorrentUploadLimit(hashes []string) (results map[string]int, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to get the upload limit of. or set to []string{"all"}, to get the upload limit of all torrents.

Returns

  • map[string]int where key is the torrent hash and value is the upload speed limit in bytes per second; this value will be zero if no limit is applied.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-upload-limit

func (*Client) GetTorrentWebSeeds

func (c *Client) GetTorrentWebSeeds(hash string) (results []TorrentSeed, err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to get the webseeds of

Http Error Codes

  • 404 Not Found, if the torrent hash is invalid
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-web-seeds

func (*Client) IncreaseTorrentPriority

func (c *Client) IncreaseTorrentPriority(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to increase the priority of. or set to []string{"all"}, to increase the priority of all torrents.

Http Error Codes

  • 409 Torrent queueing is not enabled
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#increase-torrent-priority

func (*Client) InstallSearchPlugin

func (c *Client) InstallSearchPlugin(sources []string) (err error)

Params

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#install-search-plugin

func (*Client) Login

func (c *Client) Login(username, password string) (err error)

Params

  • "username" Username used to access the WebUI
  • "password" Password used to access the WebUI

Http Error Codes

  • 403 User's IP is banned for too many failed login attempts

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#login

func (*Client) MarkRSSAsRead

func (c *Client) MarkRSSAsRead(itemPath, articleId string) (err error)

Params

  • "itemPath" Current full path of item (e.g. "The Pirate Bay\Top100")
  • "articleId" ID of article

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#mark-as-read

func (*Client) MaximalTorrentPriority

func (c *Client) MaximalTorrentPriority(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set to the maximum priority of. or set to []string{"all"}, to set all torrents to the maximum priority.

Http Error Codes

  • 409 Torrent queueing is not enabled
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#maximal-torrent-priority

func (*Client) MinimalTorrentPriority

func (c *Client) MinimalTorrentPriority(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set to the minimum priority of. or set to []string{"all"}, to set all torrents to the minimum priority.

Http Error Codes

  • 409 Torrent queueing is not enabled
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#minimal-torrent-priority

func (*Client) MoveRSSItem

func (c *Client) MoveRSSItem(itemPath, destPath string) (err error)

Params

  • "itemPath" Current full path of item (e.g. "The Pirate Bay\Top100")
  • "destPath" New full path of item (e.g. "The Pirate Bay")

Http Error Codes

  • 409 Failure to move item
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#move-item

func (*Client) PauseTorrents

func (c *Client) PauseTorrents(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to pause. or set to []string{"all"}, to pause all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#pause-torrents

func (*Client) ReannounceTorrents

func (c *Client) ReannounceTorrents(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to reannounce. or set to []string{"all"}, to reannounce all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#reannounce-torrents

func (*Client) RecheckTorrents

func (c *Client) RecheckTorrents(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to recheck. or set to []string{"all"}, to recheck all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#recheck-torrents

func (*Client) RefreshRSSItem

func (c *Client) RefreshRSSItem(itemPath string) (err error)

Params

  • "itemPath" Current full path of item (e.g. "The Pirate Bay\Top100")

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#refresh-item

func (*Client) RemoveCategories

func (c *Client) RemoveCategories(categories []string) (err error)

Removes categories from the client

Params

  • "categories" The names of the categories to remove

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-categories

func (*Client) RemoveRSSAutoDownloadingRule

func (c *Client) RemoveRSSAutoDownloadingRule(ruleName string) (err error)

Params

  • "ruleName" Name of rule

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-auto-downloading-rule

func (*Client) RemoveRSSItem

func (c *Client) RemoveRSSItem(path string) (err error)

Params

  • "path" Full path of removed item (e.g. "The Pirate Bay\Top100")

Http Error Codes

  • 409 Failure to remove item
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-item

func (*Client) RemoveTorrentTags

func (c *Client) RemoveTorrentTags(hashes, tags []string) (err error)

Removes tags from torrents

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to remove tags. or set to []string{"all"}, to remove tags from all torrents.
  • "tags" The tags to remove

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-torrent-tags

func (*Client) RemoveTrackers

func (c *Client) RemoveTrackers(hash string, urls []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

#Params

  • "hash" The hash of the torrent you want to remove trackers from.
  • "urls" The URLs of the trackers you want to remove.

Http Error Codes

  • 404 Torrent hash was not found
  • 409 All urls were not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-trackers

func (*Client) RenameFile

func (c *Client) RenameFile(hash, oldPath, newPath string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

It can move files too.

Params

  • "hash" The hash of the torrent
  • "oldPath" (relative to the torrent) The old path
  • "newPath" (relative to the torrent) The new path

Http Error Codes

  • 400 Missing newPath parameter
  • 409 Invalid newPath or oldPath, or newPath already in use
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#rename-file

func (*Client) RenameFolder

func (c *Client) RenameFolder(hash, oldPath, newPath string) (err error)

Renames the folder of a torrent (where its stored)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent
  • "oldPath" (relative to the torrent) The old path
  • "newPath" (relative to the torrent) The new path

Http Error Codes

  • 400 Missing newPath parameter
  • 409 Invalid newPath or oldPath, or newPath already in use
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#rename-folder

func (*Client) RenameRSSAutoDownloadingRule

func (c *Client) RenameRSSAutoDownloadingRule(ruleName, newRuleName string) (err error)

Params

  • "ruleName" Name of rule
  • "newRuleName" New name of rule

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#rename-auto-downloading-rule

func (*Client) ResumeTorrents

func (c *Client) ResumeTorrents(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

#Params

  • "hashes" The hashes of the torrents you want to resume. or set to []string{"all"}, to resume all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#resume-torrents

func (*Client) SetApplicationPreferences

func (c *Client) SetApplicationPreferences(prefs map[string]interface{}) (err error)

Tip

Example

params := qbittorrent.NewPreferences().
 Locale("en").
 SavePath("/home/user/Downloads")

err = client.SetApplicationPreferences(params.Data)
if err != nil {
 panic(err)
}

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-application-preferences

func (*Client) SetAutomaticTorrentManagement

func (c *Client) SetAutomaticTorrentManagement(hashes []string, enable bool) (err error)

Enable/disable auto-management for a list of torrents

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to set the auto-management. or set to []string{"all"}, to set auto-management for all torrents.
  • "enable" Enable or disable auto-management

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-automatic-torrent-management

func (*Client) SetFilePriority

func (c *Client) SetFilePriority(hash string, ids []int, priority FilePriority) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent you want to set the priority of
  • "ids" values correspond to file position inside the array returned by GetTorrentContents e.g. id=0 for first file, id=1 for second file, etc.
  • "priority" The priority you want to set

Http Error Codes

  • 400 Priority is invalid
  • 400 At least one file id is not a valid integer
  • 404 Torrent hash was not found
  • 409 Torrent metadata hasn't downloaded yet
  • 409 At least one file id was not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-file-priority

func (*Client) SetForceStart

func (c *Client) SetForceStart(hashes []string, enable bool) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to set the force start. or set to []string{"all"}, to set force start for all torrents.
  • "forceStart" Enable or disable force start

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-force-start

func (*Client) SetGlobalDownloadLimit

func (c *Client) SetGlobalDownloadLimit(limit int) (err error)

Params

  • "limit" The global download speed limit to set in bytes/second

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-global-download-limit

func (*Client) SetGlobalUploadLimit

func (c *Client) SetGlobalUploadLimit(limit int) (err error)

Params

  • "limit" The global upload speed limit to set in bytes/second

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-global-upload-limit

func (*Client) SetRSSAutoDownloadingRule

func (c *Client) SetRSSAutoDownloadingRule(ruleName string, ruleDef map[string]interface{}) (err error)

Params

  • "ruleName" Name of rule
  • "ruleDef" Definition of rule. Use NewRSSRule to build it then pass its `data` field

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-auto-downloading-rule

func (*Client) SetSuperSeeding

func (c *Client) SetSuperSeeding(hashes []string, enable bool) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to set the super seeding. or set to []string{"all"}, to set super seeding for all torrents.
  • "enable" Enable or disable super seeding

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-super-seeding

func (*Client) SetTorrentCategory

func (c *Client) SetTorrentCategory(hashes []string, category string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set the category of. or set to []string{"all"}, to set the category of all torrents.
  • "category" The new category of the torrent

Http Error Codes

  • 409 Category name does not exist
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-category

func (*Client) SetTorrentDownloadLimit

func (c *Client) SetTorrentDownloadLimit(hashes []string, limit int) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set the download limit of
  • "limit" The download speed limit in bytes per second

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-download-limit

func (*Client) SetTorrentLocation

func (c *Client) SetTorrentLocation(hashes []string, location string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set the location of. or set to []string{"all"}, to set the location of all torrents.
  • "location" The new location of the torrent

Http Error Codes

  • 400 Save path is empty
  • 403 User does not have write access to directory
  • 409 Unable to create save path directory
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-location

func (*Client) SetTorrentName

func (c *Client) SetTorrentName(hash, name string) (err error)

Changes the name of the torrent (Not the folder name)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hash" The hash of the torrent for which you want to set the name
  • "name" The new name of the torrent

Http Error Codes

  • 404 Torrent hash is invalid
  • 409 Torrent name is empty
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-name

func (*Client) SetTorrentShareLimit

func (c *Client) SetTorrentShareLimit(hashes []string, ratioLimit float64, seedingTimeLimit, inactiveSeedingTimeLimit int) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params:

  • "hashes" The hashes of the torrents for which you want to set the share limits. or set to []string{"all"}, to set all torrents share limits.
  • "ratioLimit" The maximum seeding ratio for the torrent. -2 means the global limit should be used, -1 means no limit.
  • "seedingTimeLimit" The maximum seeding time (minutes) for the torrent. -2 means the global limit should be used, -1 means no limit.
  • "inactiveSeedingTimeLimit" The maximum amount of time (minutes) the torrent is allowed to seed while being inactive. -2 means the global limit should be used, -1 means no limit.

Http Error Codes:

  • 400 Bad Request
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-share-limit

func (*Client) SetTorrentUploadLimit

func (c *Client) SetTorrentUploadLimit(hashes []string, limit int) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents you want to set the upload limit of. or set to []string{"all"}, to set the upload limit of all torrents.
  • "limit" The upload speed limit in bytes per second

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-upload-limit

func (*Client) ShutdownApplication

func (c *Client) ShutdownApplication() (err error)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#shutdown-application

func (*Client) StartSearch

func (c *Client) StartSearch(pattern string, plugins []string, category []string) (results int, err error)

Params

  • "pattern" Pattern to search for (e.g. "Ubuntu 18.04")
  • "plugins" Plugins to use for searching (e.g. "legittorrents"). Also supports `all` and `enabled`
  • "category" Categories to limit your search to (e.g. "legittorrents"). Available categories depend on the specified plugins. Also supports `all`

Returns

  • "id" ID of the search job

Http Error Codes

  • 409 User has reached the limit of max Running searches (currently set to 5)
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#start-search

func (*Client) StopSearch

func (c *Client) StopSearch(id int) (err error)

Params

  • "id" ID of the search job

Http Error Codes

  • 404 Forbidden, Search job was not found
  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#stop-search

func (*Client) ToggleAlternativeSpeedLimits

func (c *Client) ToggleAlternativeSpeedLimits() (err error)

Http Error Codes:

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#toggle-alternative-speed-limits

func (*Client) ToggleFirstLastPiecePriority

func (c *Client) ToggleFirstLastPiecePriority(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to toggle first last piece priority. or set to []string{"all"}, to toggle first last piece priority for all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-firstlast-piece-priority

func (*Client) ToggleSequentialDownload

func (c *Client) ToggleSequentialDownload(hashes []string) (err error)

Requires knowing the torrent hash. You can get it from GetTorrentList

Params

  • "hashes" The hashes of the torrents for which you want to toggle sequential download. or set to []string{"all"}, to toggle sequential download for all torrents.

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#toggle-sequential-download

func (*Client) UninstallSearchPlugin

func (c *Client) UninstallSearchPlugin(names []string) (err error)

Params

  • "names" Name of the plugin to uninstall (e.g. "legittorrents").

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#uninstall-search-plugin

func (*Client) UpdateSearchPlugins

func (c *Client) UpdateSearchPlugins() (err error)

Http Error Codes

  • 403 Forbidden, if the client is not authorized

https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#update-search-plugins

type ConnectionStatus

type ConnectionStatus string
const (
	Connected    ConnectionStatus = "connected"    // Connected to the torrent
	FireWalled   ConnectionStatus = "firewalled"   // firewalled
	Disconnected ConnectionStatus = "disconnected" // Disconnected
)

type DeleteOptions

type DeleteOptions struct {
	Hashes      []string // The hashes of the torrents you want to delete. hashes can contain multiple hashes, to delete multiple torrents, or set to []{"all"}, to delete all torrents.
	DeleteFiles bool     // If set to true, the downloaded data will also be deleted, otherwise has no effect.
}

type DyndnsService

type DyndnsService int
const (
	DyndnsServiceUseDyDNS DyndnsService = 0 // Use DyDNS
	DyndnsServiceUseNOIP  DyndnsService = 1 // Use NOIP
)

type Encryption

type Encryption int
const (
	EncryptionPrefer   Encryption = 0 // Prefer encryption
	EncryptionForceOn  Encryption = 1 // Force encryption
	EncryptionForceOff Encryption = 2 // Force no encryption
)

type FilePriority

type FilePriority int
const (
	FilePriorityDoNotDownload FilePriority = 0 // Do not download
	FilePriorityNormal        FilePriority = 1 // Normal priority
	FilePriorityHigh          FilePriority = 6 // High priority
	FilePriorityMaximal       FilePriority = 7 // Maximal priority
)

type Filters

type Filters string
const (
	FilterAll                Filters = "all"
	FilterDownloading        Filters = "downloading"
	FilterSeeding            Filters = "seeding"
	FilterCompleted          Filters = "completed"
	FilterPaused             Filters = "paused"
	FilterActive             Filters = "active"
	FilterInactive           Filters = "inactive"
	FilterResumed            Filters = "resumed"
	FilterStalled            Filters = "stalled"
	FilterStalledUploading   Filters = "stalled_uploading"
	FilterStalledDownloading Filters = "stalled_downloading"
	FilterErrored            Filters = "errored"
)

type GetLogParams

type GetLogParams struct {
	Normal      *bool // Include normal messages (default: true)
	Info        *bool // Include info messages (default: true)
	Warning     *bool // Include warning messages (default: true)
	Critical    *bool // Include critical messages (default: true)
	LastKnownId *int  // integer Exclude messages with "message id" <= last_known_id (default: -1)
}

type GetLogResponse

type GetLogResponse struct {
	Id        int            `json:"id"`        // ID of the message
	Message   string         `json:"message"`   // Text of the message
	Timestamp int            `json:"timestamp"` // Seconds since epoch (Note: switched from milliseconds to seconds in v4.5.0)
	Type      LogMessageType `json:"type"`      // Type of the message: Log::NORMAL: 1, Log::INFO: 2, Log::WARNING: 4, Log::CRITICAL: 8
}

type GetPeerLogResponse

type GetPeerLogResponse struct {
	Id        int    `json:"id"`        // ID of the peer
	Ip        string `json:"ip"`        // IP of the peer
	Timestamp int    `json:"timestamp"` // Seconds since epoch
	Blocked   bool   `json:"blocked"`   // Whether or not the peer was blocked
	Reason    string `json:"reason"`    // Reason of the block
}

type GetTorrentListOptions

type GetTorrentListOptions struct {
	Filter   Filters  // Filter torrent list by state. Allowed state filters see [qbittorrent.Filters]
	Category *string  // Get torrents with the given category. - Pass an empty string for "without category" torrents. - Leave it or pass nil for "any category" torrents.
	Tag      *string  // Get torrents with the given tag. - Pass an empty string for "without tag" torrents. - Leave it or pass nil for "any tag" torrents.
	Sort     string   // Sort torrents by given key. They can be sorted using any field of the response's array as the sort key.
	Reverse  bool     // Enable reverse sorting. Defaults to false
	Limit    int      // Limit the number of torrents returned
	Offset   int      // Set offset (if less than 0, offset from end)
	Hashes   []string // Filter by hashes.
}

type LogMessageType

type LogMessageType int
const (
	LogNormal   LogMessageType = 1
	LogInfo     LogMessageType = 2
	LogWarn     LogMessageType = 4
	LogCritical LogMessageType = 8
)

type MaxRatioAct

type MaxRatioAct int
const (
	MaxRatioActPause  MaxRatioAct = 0 // Pause torrent
	MaxRatioActRemove MaxRatioAct = 1 // Remove torrent
)

type NewTorrentOptions

type NewTorrentOptions struct {
	Data map[string]string
}

func NewTorrent

func NewTorrent() *NewTorrentOptions

func (*NewTorrentOptions) AddFromFile

func (o *NewTorrentOptions) AddFromFile(filePath string) *NewTorrentOptions

func (*NewTorrentOptions) AddUrl

func (o *NewTorrentOptions) AddUrl(uri string) *NewTorrentOptions

Add a torrent from a URL: http://, https://, magnet: and bc://bt/ links are supported.

func (*NewTorrentOptions) AutoTMM

func (o *NewTorrentOptions) AutoTMM(v bool) *NewTorrentOptions

Whether Automatic Torrent Management should be used

func (*NewTorrentOptions) Category

func (o *NewTorrentOptions) Category(cat string) *NewTorrentOptions

Category for the torrent

func (*NewTorrentOptions) Cookie

Cookie sent to download the .torrent file

func (*NewTorrentOptions) DlLimit

func (o *NewTorrentOptions) DlLimit(v int) *NewTorrentOptions

Set torrent download speed limit. Unit in bytes/second

func (*NewTorrentOptions) FirstLastPiecePrio

func (o *NewTorrentOptions) FirstLastPiecePrio(v string) *NewTorrentOptions

Prioritize download first last piece

func (*NewTorrentOptions) Paused

Add torrents in the paused state.

func (*NewTorrentOptions) RatioLimit

func (o *NewTorrentOptions) RatioLimit(v float64) *NewTorrentOptions

Set torrent share ratio limit

func (*NewTorrentOptions) Rename

Rename torrent

func (*NewTorrentOptions) RootFolder

func (o *NewTorrentOptions) RootFolder(v bool) *NewTorrentOptions

Create the root folder.

func (*NewTorrentOptions) SavePath

func (o *NewTorrentOptions) SavePath(path string) *NewTorrentOptions

Download folder

func (*NewTorrentOptions) SeedingTimeLimit

func (o *NewTorrentOptions) SeedingTimeLimit(v int) *NewTorrentOptions

Set torrent seeding time limit. Unit in minutes

func (*NewTorrentOptions) SequentialDownload

func (o *NewTorrentOptions) SequentialDownload(v string) *NewTorrentOptions

Enable sequential download.

func (*NewTorrentOptions) SkipChecking

func (o *NewTorrentOptions) SkipChecking(v bool) *NewTorrentOptions

Skip hash checking

func (*NewTorrentOptions) Tags

Tags for the torrent

func (*NewTorrentOptions) UpLimit

func (o *NewTorrentOptions) UpLimit(v int) *NewTorrentOptions

Set torrent upload speed limit. Unit in bytes/second

type Preferences

type Preferences struct {
	Data map[string]interface{}
}

func NewPreferences

func NewPreferences() *Preferences

func (*Preferences) AddTrackers

func (p *Preferences) AddTrackers(v string) *Preferences

List of trackers to add to new torrent

func (*Preferences) AddTrackersEnabled

func (p *Preferences) AddTrackersEnabled(v bool) *Preferences

Enable automatic adding of trackers to new torrents

func (*Preferences) AltDlLimit

func (p *Preferences) AltDlLimit(v int) *Preferences

Alternative global download speed limit in KiB/s

func (*Preferences) AltUpLimit

func (p *Preferences) AltUpLimit(v int) *Preferences

Alternative global upload speed limit in KiB/s

func (*Preferences) AlternativeWebuiEnabled

func (p *Preferences) AlternativeWebuiEnabled(v bool) *Preferences

True if an alternative WebUI should be used

func (*Preferences) AlternativeWebuiPath

func (p *Preferences) AlternativeWebuiPath(v string) *Preferences

File path to the alternative WebUI

func (*Preferences) AnnounceIp

func (p *Preferences) AnnounceIp(v string) *Preferences

TODO - add description

func (*Preferences) AnnounceToAllTiers

func (p *Preferences) AnnounceToAllTiers(v bool) *Preferences

True always announce to all tiers

func (*Preferences) AnnounceToAllTrackers

func (p *Preferences) AnnounceToAllTrackers(v bool) *Preferences

True always announce to all trackers in a tier

func (*Preferences) AnonymousMode

func (p *Preferences) AnonymousMode(v bool) *Preferences

If true anonymous mode will be enabled; read more here; this option is only available in qBittorent built against libtorrent version 0.16.X and higher

func (*Preferences) AsyncIoThreads

func (p *Preferences) AsyncIoThreads(v int) *Preferences

Number of asynchronous I/O threads

func (*Preferences) AutoDeleteMode

func (p *Preferences) AutoDeleteMode(v int) *Preferences

TODO - documentation missing

func (*Preferences) AutoTmmEnabled

func (p *Preferences) AutoTmmEnabled(v bool) *Preferences

True if Automatic Torrent Management is enabled by default

func (*Preferences) AutorunEnabled

func (p *Preferences) AutorunEnabled(v bool) *Preferences

True if external program should be run after torrent has finished downloading

func (*Preferences) AutorunProgram

func (p *Preferences) AutorunProgram(v string) *Preferences

Program path/name/arguments to run if autorun_enabled is enabled; path is separated by slashes; you can use %f and %n arguments, which will be expanded by qBittorent as path_to_torrent_file and torrent_name (from the GUI; not the .torrent file name) respectively

func (*Preferences) BannedIPs

func (p *Preferences) BannedIPs(v string) *Preferences

List of banned IPs

func (*Preferences) BittorrentProtocol

func (p *Preferences) BittorrentProtocol(v BittorrentProtocol) *Preferences

Bittorrent Protocol to use

func (*Preferences) BypassAuthSubnetWhitelist

func (p *Preferences) BypassAuthSubnetWhitelist(v string) *Preferences

(White)list of ipv4/ipv6 subnets for which webui authentication should be bypassed; list entries are separated by commas

func (*Preferences) BypassAuthSubnetWhitelistEnabled

func (p *Preferences) BypassAuthSubnetWhitelistEnabled(v bool) *Preferences

True if webui authentication should be bypassed for clients whose ip resides within (at least) one of the subnets on the whitelist

func (*Preferences) BypassLocalAuth

func (p *Preferences) BypassLocalAuth(v bool) *Preferences

True if authentication challenge for loopback address (127.0.0.1) should be disabled

func (*Preferences) CategoryChangedTmmEnabled

func (p *Preferences) CategoryChangedTmmEnabled(v bool) *Preferences

True if torrent should be relocated when its Category's save path changes

func (*Preferences) CheckingMemoryUse

func (p *Preferences) CheckingMemoryUse(v int) *Preferences

Outstanding memory when checking torrents in MiB

func (*Preferences) CreateSubfolderEnabled

func (p *Preferences) CreateSubfolderEnabled(v bool) *Preferences

True if a subfolder should be created when adding a torrent

func (*Preferences) CurrentInterfaceAddress

func (p *Preferences) CurrentInterfaceAddress(v string) *Preferences

IP Address to bind to. Empty String means All addresses

func (*Preferences) CurrentNetworkInterface

func (p *Preferences) CurrentNetworkInterface(v string) *Preferences

Network Interface used

func (*Preferences) Dht

func (p *Preferences) Dht(v bool) *Preferences

True if DHT is enabled

func (*Preferences) DiskCache

func (p *Preferences) DiskCache(v int) *Preferences

Disk cache used in MiB

func (*Preferences) DiskCacheTtl

func (p *Preferences) DiskCacheTtl(v int) *Preferences

Disk cache expiry interval in seconds

func (*Preferences) DlLimit

func (p *Preferences) DlLimit(v int) *Preferences

Global download speed limit in KiB/s; -1 means no limit is applied

func (*Preferences) DontCountSlowTorrents

func (p *Preferences) DontCountSlowTorrents(v bool) *Preferences

If true torrents w/o any activity (stalled ones) will not be counted towards max_active_* limits; see dont_count_slow_torrents for more information

func (*Preferences) DyndnsDomain

func (p *Preferences) DyndnsDomain(v string) *Preferences

Your DDNS domain name

func (*Preferences) DyndnsEnabled

func (p *Preferences) DyndnsEnabled(v bool) *Preferences

True if server DNS should be updated dynamically

func (*Preferences) DyndnsPassword

func (p *Preferences) DyndnsPassword(v string) *Preferences

Password for DDNS service

func (*Preferences) DyndnsService

func (p *Preferences) DyndnsService(v DyndnsService) *Preferences

See list of possible values here below

func (*Preferences) DyndnsUsername

func (p *Preferences) DyndnsUsername(v string) *Preferences

Username for DDNS service

func (*Preferences) EmbeddedTrackerPort

func (p *Preferences) EmbeddedTrackerPort(v int) *Preferences

Port used for embedded tracker

func (*Preferences) EnableCoalesceReadWrite

func (p *Preferences) EnableCoalesceReadWrite(v bool) *Preferences

True enables coalesce reads & writes

func (*Preferences) EnableEmbeddedTracker

func (p *Preferences) EnableEmbeddedTracker(v bool) *Preferences

True enables embedded tracker

func (*Preferences) EnableMultiConnectionsFromSameIP

func (p *Preferences) EnableMultiConnectionsFromSameIP(v bool) *Preferences

True allows multiple connections from the same IP address

func (*Preferences) EnableOsCache

func (p *Preferences) EnableOsCache(v bool) *Preferences

True enables os cache

func (*Preferences) EnablePieceExtentAffinity

func (p *Preferences) EnablePieceExtentAffinity(v bool) *Preferences

True if the advanced libtorrent option piece_extent_affinity is enabled

func (*Preferences) EnableUploadSuggestions

func (p *Preferences) EnableUploadSuggestions(v bool) *Preferences

True enables sending of upload piece suggestions

func (*Preferences) Encryption

func (p *Preferences) Encryption(v Encryption) *Preferences

See list of possible values here below

func (*Preferences) ExportDir

func (p *Preferences) ExportDir(v string) *Preferences

Path to directory to copy .torrent files to. Slashes are used as path separators

func (*Preferences) ExportDirFin

func (p *Preferences) ExportDirFin(v string) *Preferences

Path to directory to copy .torrent files of completed downloads to. Slashes are used as path separators

func (*Preferences) FilePoolSize

func (p *Preferences) FilePoolSize(v int) *Preferences

File pool size

func (*Preferences) IncompleteFilesExt

func (p *Preferences) IncompleteFilesExt(v bool) *Preferences

True if ".!qB" should be appended to incomplete files

func (*Preferences) IpFilterEnabled

func (p *Preferences) IpFilterEnabled(v bool) *Preferences

True if external IP filter should be enabled

func (*Preferences) IpFilterPath

func (p *Preferences) IpFilterPath(v string) *Preferences

Path to IP filter file (.dat, .p2p, .p2b files are supported); path is separated by slashes

func (*Preferences) IpFilterTrackers

func (p *Preferences) IpFilterTrackers(v bool) *Preferences

True if IP filters are applied to trackers

func (*Preferences) LimitLanPeers

func (p *Preferences) LimitLanPeers(v bool) *Preferences

True if [du]l_limit should be applied to peers on the LAN

func (*Preferences) LimitTcpOverhead

func (p *Preferences) LimitTcpOverhead(v bool) *Preferences

True if [du]l_limit should be applied to estimated TCP overhead (service data: e.g. packet headers)

func (*Preferences) LimitUtpRate

func (p *Preferences) LimitUtpRate(v bool) *Preferences

True if [du]l_limit should be applied to uTP connections; this option is only available in qBittorent built against libtorrent version 0.16.X and higher

func (*Preferences) ListenPort

func (p *Preferences) ListenPort(v int) *Preferences

Port for incoming connections

func (*Preferences) Locale

func (p *Preferences) Locale(v string) *Preferences

Currently selected language (e.g. en_GB for English)

func (*Preferences) Lsd

func (p *Preferences) Lsd(v bool) *Preferences

True if LSD is enabled

func (*Preferences) MailNotificationAuthEnabled

func (p *Preferences) MailNotificationAuthEnabled(v bool) *Preferences

True if smtp server requires authentication

func (*Preferences) MailNotificationEmail

func (p *Preferences) MailNotificationEmail(v string) *Preferences

e-mail to send notifications to

func (*Preferences) MailNotificationEnabled

func (p *Preferences) MailNotificationEnabled(v bool) *Preferences

True if e-mail notification should be enabled

func (*Preferences) MailNotificationPassword

func (p *Preferences) MailNotificationPassword(v string) *Preferences

Password for smtp authentication

func (*Preferences) MailNotificationSender

func (p *Preferences) MailNotificationSender(v string) *Preferences

e-mail where notifications should originate from

func (*Preferences) MailNotificationSmtp

func (p *Preferences) MailNotificationSmtp(v string) *Preferences

smtp server for e-mail notifications

func (*Preferences) MailNotificationSslEnabled

func (p *Preferences) MailNotificationSslEnabled(v bool) *Preferences

True if smtp server requires SSL connection

func (*Preferences) MailNotificationUsername

func (p *Preferences) MailNotificationUsername(v string) *Preferences

Username for smtp authentication

func (*Preferences) MaxActiveDownloads

func (p *Preferences) MaxActiveDownloads(v int) *Preferences

Maximum number of active simultaneous downloads

func (*Preferences) MaxActiveTorrents

func (p *Preferences) MaxActiveTorrents(v int) *Preferences

Maximum number of active simultaneous downloads and uploads

func (*Preferences) MaxActiveUploads

func (p *Preferences) MaxActiveUploads(v int) *Preferences

Maximum number of active simultaneous uploads

func (*Preferences) MaxConnec

func (p *Preferences) MaxConnec(v int) *Preferences

Maximum global number of simultaneous connections

func (*Preferences) MaxConnecPerTorrent

func (p *Preferences) MaxConnecPerTorrent(v int) *Preferences

Maximum number of simultaneous connections per torrent

func (*Preferences) MaxRatio

func (p *Preferences) MaxRatio(v float64) *Preferences

Get the global share ratio limit

func (*Preferences) MaxRatioAct

func (p *Preferences) MaxRatioAct(v DyndnsService) *Preferences

Action performed when a torrent reaches the maximum share ratio. See list of possible values here below.

func (*Preferences) MaxRatioEnabled

func (p *Preferences) MaxRatioEnabled(v bool) *Preferences

True if share ratio limit is enabled

func (*Preferences) MaxSeedingTime

func (p *Preferences) MaxSeedingTime(v int) *Preferences

Number of minutes to seed a torrent

func (*Preferences) MaxSeedingTimeEnabled

func (p *Preferences) MaxSeedingTimeEnabled(v bool) *Preferences

True enables max seeding time

func (*Preferences) MaxUploads

func (p *Preferences) MaxUploads(v int) *Preferences

Maximum number of upload slots

func (*Preferences) MaxUploadsPerTorrent

func (p *Preferences) MaxUploadsPerTorrent(v int) *Preferences

Maximum number of upload slots per torrent

func (*Preferences) OutgoingPortsMax

func (p *Preferences) OutgoingPortsMax(v int) *Preferences

Maximal outgoing port (0: Disabled)

func (*Preferences) OutgoingPortsMin

func (p *Preferences) OutgoingPortsMin(v int) *Preferences

Minimal outgoing port (0: Disabled)

func (*Preferences) Pex

func (p *Preferences) Pex(v bool) *Preferences

True if PeX is enabled

func (*Preferences) PreallocateAll

func (p *Preferences) PreallocateAll(v bool) *Preferences

True if disk space should be pre-allocated for all files

func (*Preferences) ProxyAuthEnabled

func (p *Preferences) ProxyAuthEnabled(v bool) *Preferences

True proxy requires authentication; doesn't apply to SOCKS4 proxies

func (*Preferences) ProxyIp

func (p *Preferences) ProxyIp(v string) *Preferences

Proxy IP address or domain name

func (*Preferences) ProxyPassword

func (p *Preferences) ProxyPassword(v string) *Preferences

Password for proxy authentication

func (*Preferences) ProxyPeerConnections

func (p *Preferences) ProxyPeerConnections(v bool) *Preferences

True if peer and web seed connections should be proxified; this option will have any effect only in qBittorent built against libtorrent version 0.16.X and higher

func (*Preferences) ProxyPort

func (p *Preferences) ProxyPort(v int) *Preferences

Proxy port

func (*Preferences) ProxyTorrentsOnly

func (p *Preferences) ProxyTorrentsOnly(v bool) *Preferences

True if proxy is only used for torrents

func (*Preferences) ProxyType

func (p *Preferences) ProxyType(v int) *Preferences

See list of possible values here below

func (*Preferences) ProxyUsername

func (p *Preferences) ProxyUsername(v string) *Preferences

Username for proxy authentication

func (*Preferences) QueueingEnabled

func (p *Preferences) QueueingEnabled(v bool) *Preferences

True if torrent queuing is enabled

func (*Preferences) RandomPort

func (p *Preferences) RandomPort(v bool) *Preferences

True if the port is randomly selected

func (*Preferences) RecheckCompletedTorrents

func (p *Preferences) RecheckCompletedTorrents(v bool) *Preferences

True rechecks torrents on completion

func (*Preferences) ResolvePeerCountries

func (p *Preferences) ResolvePeerCountries(v bool) *Preferences

True resolves peer countries

func (*Preferences) RssAutoDownloadingEnabled

func (p *Preferences) RssAutoDownloadingEnabled(v bool) *Preferences

Enable auto-downloading of torrents from the RSS feeds

func (*Preferences) RssDownloadRepackProperEpisodes

func (p *Preferences) RssDownloadRepackProperEpisodes(v bool) *Preferences

For API ≥ v2.5.1: Enable downloading of repack/proper Episodes

func (*Preferences) RssMaxArticlesPerFeed

func (p *Preferences) RssMaxArticlesPerFeed(v int) *Preferences

Max stored articles per RSS feed

func (*Preferences) RssProcessingEnabled

func (p *Preferences) RssProcessingEnabled(v bool) *Preferences

Enable processing of RSS feeds

func (*Preferences) RssRefreshInterval

func (p *Preferences) RssRefreshInterval(v int) *Preferences

RSS refresh interval

func (*Preferences) RssSmartEpisodeFilters

func (p *Preferences) RssSmartEpisodeFilters(v string) *Preferences

For API ≥ v2.5.1: List of RSS Smart Episode Filters

func (*Preferences) SavePath

func (p *Preferences) SavePath(v string) *Preferences

Default save path for torrents, separated by slashes

func (*Preferences) SavePathChangedTmmEnabled

func (p *Preferences) SavePathChangedTmmEnabled(v bool) *Preferences

True if torrent should be relocated when the default save path changes

func (*Preferences) SaveResumeDataInterval

func (p *Preferences) SaveResumeDataInterval(v int) *Preferences

Save resume data interval in min

func (*Preferences) ScanDirs

func (p *Preferences) ScanDirs(v map[string]interface{}) *Preferences

Property: directory to watch for torrent files, value: where torrents loaded from this directory should be downloaded to. Slashes are used as path separators; multiple key/value pairs can be specified

Possible values of scan_dirs

  • `0` Download to the monitored folder
  • `1` Download to the default save path
  • "/path/to/download/to" Download to this path

func (*Preferences) ScheduleFromHour

func (p *Preferences) ScheduleFromHour(v int) *Preferences

Scheduler starting hour

func (*Preferences) ScheduleFromMin

func (p *Preferences) ScheduleFromMin(v int) *Preferences

Scheduler starting minute

func (*Preferences) ScheduleToHour

func (p *Preferences) ScheduleToHour(v int) *Preferences

Scheduler ending hour

func (*Preferences) ScheduleToMin

func (p *Preferences) ScheduleToMin(v int) *Preferences

Scheduler ending minute

func (*Preferences) SchedulerDays

func (p *Preferences) SchedulerDays(v SchedulerDays) *Preferences

Scheduler days. See possible values here below

func (*Preferences) SchedulerEnabled

func (p *Preferences) SchedulerEnabled(v bool) *Preferences

True if alternative limits should be applied according to schedule

func (*Preferences) SendBufferLowWatermark

func (p *Preferences) SendBufferLowWatermark(v int) *Preferences

Send buffer low watermark in KiB

func (*Preferences) SendBufferWatermark

func (p *Preferences) SendBufferWatermark(v int) *Preferences

Send buffer watermark in KiB

func (*Preferences) SlowTorrentDlRateThreshold

func (p *Preferences) SlowTorrentDlRateThreshold(v int) *Preferences

Download rate in KiB/s for a torrent to be considered "slow"

func (*Preferences) SlowTorrentInactiveTimer

func (p *Preferences) SlowTorrentInactiveTimer(v int) *Preferences

Seconds a torrent should be inactive before considered "slow"

func (*Preferences) SlowTorrentUlRateThreshold

func (p *Preferences) SlowTorrentUlRateThreshold(v int) *Preferences

Upload rate in KiB/s for a torrent to be considered "slow"

func (*Preferences) SocketBacklogSize

func (p *Preferences) SocketBacklogSize(v int) *Preferences

Send buffer watermark factor in percent

func (*Preferences) SslCert

func (p *Preferences) SslCert(v string) *Preferences

For API < v2.0.1: SSL certificate contents (this is a not a path)

func (*Preferences) SslKey

func (p *Preferences) SslKey(v string) *Preferences

For API < v2.0.1: SSL keyfile contents (this is a not a path)

func (*Preferences) StartPausedEnabled

func (p *Preferences) StartPausedEnabled(v bool) *Preferences

True if torrents should be added in a Paused state

func (*Preferences) StopTrackerTimeout

func (p *Preferences) StopTrackerTimeout(v int) *Preferences

Timeout in seconds for a stopped announce request to trackers

func (*Preferences) TempPath

func (p *Preferences) TempPath(v string) *Preferences

Path for incomplete torrents, separated by slashes

func (*Preferences) TempPathEnabled

func (p *Preferences) TempPathEnabled(v bool) *Preferences

True if folder for incomplete torrents is enabled

func (*Preferences) TorrentChangedTmmEnabled

func (p *Preferences) TorrentChangedTmmEnabled(v bool) *Preferences

True if torrent should be relocated when its Category changes

func (*Preferences) UpLimit

func (p *Preferences) UpLimit(v int) *Preferences

Global upload speed limit in KiB/s; -1 means no limit is applied

func (*Preferences) UploadChokingAlgorithm

func (p *Preferences) UploadChokingAlgorithm(v UploadChokingAlgorithm) *Preferences

Upload choking algorithm used

func (*Preferences) UploadSlotsBehavior

func (p *Preferences) UploadSlotsBehavior(v UploadSlotsBehavior) *Preferences

Upload slots behavior used

func (*Preferences) Upnp

func (p *Preferences) Upnp(v bool) *Preferences

True if UPnP/NAT-PMP is enabled

func (*Preferences) UpnpLeaseDuration

func (p *Preferences) UpnpLeaseDuration(v int) *Preferences

UPnP lease duration (0: Permanent lease)

func (*Preferences) UseHttps

func (p *Preferences) UseHttps(v bool) *Preferences

True if WebUI HTTPS access is enabled

func (*Preferences) UtpTcpMixedMode

func (p *Preferences) UtpTcpMixedMode(v UtpTcpMixedMode) *Preferences

μTP-TCP mixed mode algorithm

func (*Preferences) WebUiAddress

func (p *Preferences) WebUiAddress(v string) *Preferences

IP address to use for the WebUI

func (*Preferences) WebUiBanDuration

func (p *Preferences) WebUiBanDuration(v int) *Preferences

WebUI access ban duration in seconds

func (*Preferences) WebUiClickjackingProtectionEnabled

func (p *Preferences) WebUiClickjackingProtectionEnabled(v bool) *Preferences

True if WebUI clickjacking protection is enabled

func (*Preferences) WebUiCsrfProtectionEnabled

func (p *Preferences) WebUiCsrfProtectionEnabled(v bool) *Preferences

True if WebUI CSRF protection is enabled

func (*Preferences) WebUiCustomHttpHeaders

func (p *Preferences) WebUiCustomHttpHeaders(v string) *Preferences

For API ≥ v2.5.1: List of custom http headers

func (*Preferences) WebUiDomainList

func (p *Preferences) WebUiDomainList(v string) *Preferences

Semicolon-separated list of domains to accept when performing Host header validation

func (*Preferences) WebUiHostHeaderValidationEnabled

func (p *Preferences) WebUiHostHeaderValidationEnabled(v bool) *Preferences

True if WebUI host header validation is enabled

func (*Preferences) WebUiHttpsCertPath

func (p *Preferences) WebUiHttpsCertPath(v string) *Preferences

For API ≥ v2.0.1: Path to SSL certificate

func (*Preferences) WebUiHttpsKeyPath

func (p *Preferences) WebUiHttpsKeyPath(v string) *Preferences

For API ≥ v2.0.1: Path to SSL keyfile

func (*Preferences) WebUiMaxAuthFailCount

func (p *Preferences) WebUiMaxAuthFailCount(v int) *Preferences

Maximum number of authentication failures before WebUI access ban

func (*Preferences) WebUiPassword

func (p *Preferences) WebUiPassword(v string) *Preferences

For API ≥ v2.3.0: Plaintext WebUI password, not readable, write-only. For API < v2.3.0: MD5 hash of WebUI password, hash is generated from the following string: usernameUI Access

func (*Preferences) WebUiPort

func (p *Preferences) WebUiPort(v int) *Preferences

WebUI port

func (*Preferences) WebUiSecureCookieEnabled

func (p *Preferences) WebUiSecureCookieEnabled(v bool) *Preferences

True if WebUI cookie Secure flag is enabled

func (*Preferences) WebUiSessionTimeout

func (p *Preferences) WebUiSessionTimeout(v int) *Preferences

Seconds until WebUI is automatically signed off

func (*Preferences) WebUiUpnp

func (p *Preferences) WebUiUpnp(v bool) *Preferences

True if UPnP is used for the WebUI port

func (*Preferences) WebUiUseCustomHttpHeadersEnabled

func (p *Preferences) WebUiUseCustomHttpHeadersEnabled(v bool) *Preferences

For API ≥ v2.5.1: Enable custom http headers

func (*Preferences) WebUiUsername

func (p *Preferences) WebUiUsername(v string) *Preferences

WebUI username

type ProxyType

type ProxyType int
const (
	ProxyIsDisabled                  ProxyType = -1 // Proxy is disabled
	ProxyHTTPWithoutAuthentication   ProxyType = 1  // HTTP proxy without authentication
	ProxySOCKS5WithoutAuthentication ProxyType = 2  // SOCKS5 proxy without authentication
	ProxyHTTPWithAuthentication      ProxyType = 3  // HTTP proxy with authentication
	ProxySOCKS5WithAuthentication    ProxyType = 4  // SOCKS5 proxy with authentication
	ProxySOCKS4WithoutAuthentication ProxyType = 5  // SOCKS4 proxy without authentication
)

type RSSDownloadingRule

type RSSDownloadingRule struct {
	Enabled                   bool     `json:"enabled"`                   // Whether the rule is enabled
	MustContain               string   `json:"mustContain"`               // The substring that the torrent name must contain
	MustNotContain            string   `json:"mustNotContain"`            // The substring that the torrent name must not contain
	UseRegex                  bool     `json:"useRegex"`                  // Enable regex mode in "mustContain" and "mustNotContain"
	EpisodeFilter             string   `json:"episodeFilter"`             // Episode filter definition
	SmartFilter               bool     `json:"smartFilter"`               // Enable smart episode filter
	PreviouslyMatchedEpisodes []int    `json:"previouslyMatchedEpisodes"` // The list of episode IDs already matched by smart filter
	AffectedFeeds             []string `json:"affectedFeeds"`             // The feed URLs the rule applied to
	IgnoreDays                int      `json:"ignoreDays"`                // Ignore subsequent rule matches for these days
	LastMatch                 string   `json:"lastMatch"`                 // The rule's last match time
	AddPaused                 bool     `json:"addPaused"`                 // Add matched torrent in paused mode
	AssignedCategory          string   `json:"assignedCategory"`          // Assign category to the torrent
	SavePath                  string   `json:"savePath"`                  // Save torrent to the given directory
}

type RssRule

type RssRule struct {
	Data map[string]interface{}
}

func NewRSSRule

func NewRSSRule() *RssRule

func (*RssRule) AddPaused

func (r *RssRule) AddPaused(v bool) *RssRule

Add matched torrent in paused mode

func (*RssRule) AffectedFeeds

func (r *RssRule) AffectedFeeds(v []string) *RssRule

The feed URLs the rule applied to

func (*RssRule) AssignedCategory

func (r *RssRule) AssignedCategory(v string) *RssRule

Assign category to the torrent

func (*RssRule) Enabled

func (r *RssRule) Enabled(v bool) *RssRule

Whether the rule is enabled

func (*RssRule) EpisodeFilter

func (r *RssRule) EpisodeFilter(v string) *RssRule

Episode filter definition

func (*RssRule) IgnoreDays

func (r *RssRule) IgnoreDays(v int) *RssRule

Ignore sunsequent rule matches

func (*RssRule) LastMatch

func (r *RssRule) LastMatch(v string) *RssRule

The rule last match time

func (*RssRule) MustContain

func (r *RssRule) MustContain(v string) *RssRule

The substring that the torrent name must contain

func (*RssRule) MustNotContain

func (r *RssRule) MustNotContain(v string) *RssRule

The substring that the torrent name must not contain

func (*RssRule) PreviouslyMatchedEpisodes

func (r *RssRule) PreviouslyMatchedEpisodes(v []int) *RssRule

The list of episode IDs already matched by smart filter

func (*RssRule) SavePath

func (r *RssRule) SavePath(v string) *RssRule

Save torrent to the given directory

func (*RssRule) SmartFilter

func (r *RssRule) SmartFilter(v bool) *RssRule

Enable smart episode filter

func (*RssRule) UseRegex

func (r *RssRule) UseRegex(v bool) *RssRule

Enable regex mode in "mustContain" and "mustNotContain"

type SchedulerDays

type SchedulerDays int
const (
	SchedulerEveryDay       SchedulerDays = 0 // Every day
	SchedulerEveryWeekday   SchedulerDays = 1 // Every weekday
	SchedulerEveryWeekend   SchedulerDays = 2 // Every weekend
	SchedulerEveryMonday    SchedulerDays = 3 // Every Monday
	SchedulerEveryTuesday   SchedulerDays = 4 // Every Tuesday
	SchedulerEveryWednesday SchedulerDays = 5 // Every Wednesday
	SchedulerEveryThursday  SchedulerDays = 6 // Every Thursday
	SchedulerEveryFriday    SchedulerDays = 7 // Every Friday
	SchedulerEverySaturday  SchedulerDays = 8 // Every Saturday
	SchedulerEverySunday    SchedulerDays = 9 // Every Sunday
)

type SearchCategory

type SearchCategory struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type SearchId

type SearchId struct {
	Id int `json:"id"` // the id of the search job
}

type SearchPluginsResponse

type SearchPluginsResponse struct {
	Enabled             bool             `json:"enabled"`             // Whether the plugin is enabled
	FullName            string           `json:"fullName"`            // Full name of the plugin
	Name                string           `json:"name"`                // Short name of the plugin
	SupportedCategories []SearchCategory `json:"supportedCategories"` // List of category objects
	Url                 string           `json:"url"`                 // URL of the torrent site
	Version             string           `json:"version"`             // Installed version of the plugin
}

type SearchResult

type SearchResult struct {
	DescrLink  string `json:"descrLink"`  // URL of the torrent's description page
	FileName   string `json:"fileName"`   // Name of the file
	FileSize   int    `json:"fileSize"`   // Size of the file in Bytes
	FileUrl    string `json:"fileUrl"`    // Torrent download link (usually either .torrent file or magnet link)
	NbLeechers int    `json:"nbLeechers"` // Number of leechers
	NbSeeders  int    `json:"nbSeeders"`  // Number of seeders
	SiteUrl    string `json:"siteUrl"`    // URL of the torrent site
}

type SearchResultsResponse

type SearchResultsResponse struct {
	Results []SearchResult `json:"results"`
	Status  SearchStatus   // Current status of the search job (either Running or Stopped)
	Total   int            // Total number of results. If the status is Running this number may continue to increase
}

type SearchStatus

type SearchStatus string
const (
	SearchStatusRunning SearchStatus = "Running"
	SearchStatusStopped SearchStatus = "Stopped"
)

type SearchStatusResponse

type SearchStatusResponse struct {
	Id     int          `json:"id"`     // ID of the search job
	Status SearchStatus `json:"status"` // Current status of the search job (either Running or Stopped)
	Total  int          `json:"total"`  // Total number of results. If the status is Running this number may contineu to increase
}

type ServerState

type ServerState struct {
	AllTimeDL            int64            `json:"alltime_dl"`
	AllTimeUL            int64            `json:"alltime_ul"`
	AverageTimeQueue     int              `json:"average_time_queue"`
	ConnectionStatus     ConnectionStatus `json:"connection_status"`
	DHTNodes             int              `json:"dht_nodes"`
	DLInfoData           int64            `json:"dl_info_data"`
	DLInfoSpeed          int64            `json:"dl_info_speed"`
	DLRateLimit          int64            `json:"dl_rate_limit"`
	FreeSpaceOnDisk      int64            `json:"free_space_on_disk"`
	GlobalRatio          string           `json:"global_ratio"`
	QueuedIOJobs         int              `json:"queued_io_jobs"`
	Queueing             bool             `json:"queueing"`
	ReadCacheHits        string           `json:"read_cache_hits"`
	ReadCacheOverload    string           `json:"read_cache_overload"`
	RefreshInterval      int              `json:"refresh_interval"`
	TotalBuffersSize     int64            `json:"total_buffers_size"`
	TotalPeerConnections int              `json:"total_peer_connections"`
	TotalQueuedSize      int64            `json:"total_queued_size"`
	TotalWastedSession   int64            `json:"total_wasted_session"`
	UPInfoData           int64            `json:"up_info_data"`
	UPInfoSpeed          int64            `json:"up_info_speed"`
	UPRateLimit          int64            `json:"up_rate_limit"`
	UseAltSpeedLimits    bool             `json:"use_alt_speed_limits"`
	WriteCacheOverload   string           `json:"write_cache_overload"`
}

type SyncMainDataResponse

type SyncMainDataResponse struct {
	Rid               int                   `json:"rid"`                // Response ID
	FullUpdate        bool                  `json:"full_update"`        // Whether the response contains all the data or partial data
	Torrents          TorrentListResponse   `json:"torrents"`           // Property: torrent hash, value: same as torrent list
	TorrentsRemoved   []string              `json:"torrents_removed"`   // List of hashes of torrents removed since last request
	Categories        map[string]Category   `json:"categories"`         // Info for categories added since last request
	CategoriesRemoved []map[string]Category `json:"categories_removed"` // List of categories removed since last request
	Tags              []string              `json:"tags"`               // List of tags added since last request
	TagsRemoved       []string              `json:"tags_removed"`       // array	List of tags removed since last request
	ServerState       ServerState           `json:"server_state"`       // object	Global transfer info
}

type TorrentFile

type TorrentFile struct {
	Index        int          `json:"index"`        // File index
	Name         string       `json:"name"`         // File name (including relative path)
	Size         int64        `json:"size"`         // File size in bytes
	Progress     float64      `json:"progress"`     // File progress as a fraction (percentage/100)
	Priority     FilePriority `json:"priority"`     // File priority (see FilePriority enum for possible values)
	IsSeed       bool         `json:"is_seed"`      // True if file is seeding/complete
	PieceRange   []int        `json:"piece_range"`  // Array with the first number as the starting piece index and the second as the ending piece index (inclusive)
	Availability float64      `json:"availability"` // Percentage of file pieces currently available (percentage/100)
}

type TorrentGenericProperties

type TorrentGenericProperties struct {
	SavePath               string  `json:"save_path"`                // Torrent save path
	CreationDate           int64   `json:"creation_date"`            // Torrent creation date (Unix timestamp)
	PieceSize              int64   `json:"piece_size"`               // Torrent piece size (bytes)
	Comment                string  `json:"comment"`                  // Torrent comment
	TotalWasted            int64   `json:"total_wasted"`             // Total data wasted for torrent (bytes)
	TotalUploaded          int64   `json:"total_uploaded"`           // Total data uploaded for torrent (bytes)
	TotalUploadedSession   int64   `json:"total_uploaded_session"`   // Total data uploaded this session (bytes)
	TotalDownloaded        int64   `json:"total_downloaded"`         // Total data downloaded for torrent (bytes)
	TotalDownloadedSession int64   `json:"total_downloaded_session"` // Total data downloaded this session (bytes)
	UpLimit                int64   `json:"up_limit"`                 // Torrent upload limit (bytes/s)
	DlLimit                int64   `json:"dl_limit"`                 // Torrent download limit (bytes/s)
	TimeElapsed            int64   `json:"time_elapsed"`             // Torrent elapsed time (seconds)
	SeedingTime            int64   `json:"seeding_time"`             // Torrent elapsed time while complete (seconds)
	NbConnections          int     `json:"nb_connections"`           // Torrent connection count
	NbConnectionsLimit     int     `json:"nb_connections_limit"`     // Torrent connection count limit
	ShareRatio             float64 `json:"share_ratio"`              // Torrent share ratio
	AdditionDate           int64   `json:"addition_date"`            // When this torrent was added (unix timestamp)
	CompletionDate         int64   `json:"completion_date"`          // Torrent completion date (unix timestamp)
	CreatedBy              string  `json:"created_by"`               // Torrent creator
	DlSpeedAvg             int64   `json:"dl_speed_avg"`             // Torrent average download speed (bytes/second)
	DlSpeed                int64   `json:"dl_speed"`                 // Torrent download speed (bytes/second)
	ETA                    int64   `json:"eta"`                      // Torrent ETA (seconds)
	LastSeen               int64   `json:"last_seen"`                // Last seen complete date (unix timestamp)
	Peers                  int     `json:"peers"`                    // Number of peers connected to
	PeersTotal             int     `json:"peers_total"`              // Number of peers in the swarm
	PiecesHave             int     `json:"pieces_have"`              // Number of pieces owned
	PiecesNum              int     `json:"pieces_num"`               // Number of pieces of the torrent
	Reannounce             int64   `json:"reannounce"`               // Number of seconds until the next announce
	Seeds                  int     `json:"seeds"`                    // Number of seeds connected to
	SeedsTotal             int     `json:"seeds_total"`              // Number of seeds in the swarm
	TotalSize              int64   `json:"total_size"`               // Torrent total size (bytes)
	UpSpeedAvg             int64   `json:"up_speed_avg"`             // Torrent average upload speed (bytes/second)
	UpSpeed                int64   `json:"up_speed"`                 // Torrent upload speed (bytes/second)
	IsPrivate              bool    `json:"isPrivate"`                // True if torrent is from a private tracker
}

type TorrentListResponse

type TorrentListResponse struct {
	AddedOn           int          `json:"added_on"`           // Time (Unix Epoch) when the torrent was added to the client
	AmountLeft        int          `json:"amount_left"`        // Amount of data left to download (bytes)
	AutoTmm           bool         `json:"auto_tmm"`           // Whether this torrent is managed by Automatic Torrent Management
	Availability      float64      `json:"availability"`       // Percentage of file pieces currently available
	Category          string       `json:"category"`           // Category of the torrent
	Completed         int          `json:"completed"`          // Amount of transfer data completed (bytes)
	CompletionOn      int          `json:"completion_on"`      // Time (Unix Epoch) when the torrent completed
	ContentPath       string       `json:"content_path"`       // Absolute path of torrent content (root path for multifile torrents, absolute file path for singlefile torrents)
	DlLimit           float64      `json:"dl_limit"`           // Torrent download speed limit (bytes/s). -1 if unlimited.
	DlSpeed           float64      `json:"dlspeed"`            // Torrent download speed (bytes/s)
	Downloaded        float64      `json:"downloaded"`         // Amount of data downloaded
	DownloadedSession float64      `json:"downloaded_session"` // Amount of data downloaded this session
	ETA               int          `json:"eta"`                // Torrent ETA (seconds)
	FLPiecePrio       bool         `json:"f_l_piece_prio"`     // True if first last piece are prioritized
	ForceStart        bool         `json:"force_start"`        // True if force start is enabled for this torrent
	Hash              string       `json:"hash"`               // Torrent hash
	IsPrivate         bool         `json:"is_private"`         // True if torrent is from a private tracker (added in 5.0.0)
	LastActivity      int          `json:"last_activity"`      // Last time (Unix Epoch) when a chunk was downloaded/uploaded
	MagnetURI         string       `json:"magnet_uri"`         // Magnet URI corresponding to this torrent
	MaxRatio          float64      `json:"max_ratio"`          // Maximum share ratio until torrent is stopped from seeding/uploading
	MaxSeedingTime    int          `json:"max_seeding_time"`   // Maximum seeding time (seconds) until torrent is stopped from seeding
	Name              string       `json:"name"`               // Torrent name
	NumComplete       int          `json:"num_complete"`       // Number of seeds in the swarm
	NumIncomplete     int          `json:"num_incomplete"`     // Number of leechers in the swarm
	NumLeechs         int          `json:"num_leechs"`         // Number of leechers connected to
	NumSeeds          int          `json:"num_seeds"`          // Number of seeds connected to
	Priority          int          `json:"priority"`           // Torrent priority. Returns -1 if queuing is disabled or torrent is in seed mode
	Progress          float64      `json:"progress"`           // Torrent progress (percentage/100)
	Ratio             float64      `json:"ratio"`              // Torrent share ratio. Max ratio value: 9999.
	RatioLimit        float64      `json:"ratio_limit"`        // TODO (what is different from max_ratio?)
	SavePath          string       `json:"save_path"`          // Path where this torrent's data is stored
	SeedingTime       int          `json:"seeding_time"`       // Torrent elapsed time while complete (seconds)
	SeedingTimeLimit  int          `json:"seeding_time_limit"` // TODO (what is different from max_seeding_time?)
	SeenComplete      int          `json:"seen_complete"`      // Time (Unix Epoch) when this torrent was last seen complete
	SeqDL             bool         `json:"seq_dl"`             // True if sequential download is enabled
	Size              int          `json:"size"`               // Total size (bytes) of files selected for download
	State             TorrentState `json:"state"`              // Torrent state. See [TorrentState] possible values
	SuperSeeding      bool         `json:"super_seeding"`      // True if super seeding is enabled
	Tags              string       `json:"tags"`               // Comma-concatenated tag list of the torrent
	TimeActive        int          `json:"time_active"`        // Total active time (seconds)
	TotalSize         int          `json:"total_size"`         // Total size (bytes) of all file in this torrent (including unselected ones)
	Tracker           string       `json:"tracker"`            // The first tracker with working status. Returns empty string if no tracker is working.
	UpLimit           int          `json:"up_limit"`           // Torrent upload speed limit (bytes/s). -1 if unlimited.
	Uploaded          int          `json:"uploaded"`           // Amount of data uploaded
	UploadedSession   int          `json:"uploaded_session"`   // Amount of data uploaded this session
	UpSpeed           int          `json:"upspeed"`            // Torrent upload speed (bytes/s)
}

type TorrentPiecesState

type TorrentPiecesState int
const (
	TorrentPiecesNotDownloaded    TorrentPiecesState = 0 // Not downloaded yet
	TorrentPiecesStateDownloading TorrentPiecesState = 1 // Downloading
	TorrentPiecesStateDone        TorrentPiecesState = 2 // Already downloaded
)

type TorrentSeed

type TorrentSeed struct {
	Url string `json:"url"` // URL of the web seed
}

type TorrentState

type TorrentState string
const (
	TorrentStateError              TorrentState = "error"              // Some error occurred, applies to paused torrents
	TorrentStateMissingFiles       TorrentState = "missingFiles"       // Torrent data files is missing
	TorrentStateUploading          TorrentState = "uploading"          // Torrent is being seeded and data is being transferred
	TorrentStatePausedUP           TorrentState = "pausedUP"           // Torrent is paused and has finished downloading
	TorrentStateQueuedUP           TorrentState = "queuedUP"           // Queuing is enabled and torrent is queued for upload
	TorrentStateStalledUP          TorrentState = "stalledUP"          // Torrent is being seeded, but no connection were made
	TorrentStateCheckingUP         TorrentState = "checkingUP"         // Torrent has finished downloading and is being checked
	TorrentStateForcedUP           TorrentState = "forcedUP"           // Torrent is forced to uploading and ignore queue limit
	TorrentStateAllocating         TorrentState = "allocating"         // Torrent is allocating disk space for download
	TorrentStateDownloading        TorrentState = "downloading"        // Torrent is being downloaded and data is being transferred
	TorrentStateMetaDL             TorrentState = "metaDL"             // Torrent has just started downloading and is fetching metadata
	TorrentStatePausedDL           TorrentState = "pausedDL"           // Torrent is paused and has NOT finished downloading
	TorrentStateQueuedDL           TorrentState = "queuedDL"           // Queuing is enabled and torrent is queued for download
	TorrentStateStalledDL          TorrentState = "stalledDL"          // Torrent is being downloaded, but no connection were made
	TorrentStateCheckingDL         TorrentState = "checkingDL"         // Same as checkingUP, but torrent has NOT finished downloading
	TorrentStateForcedDL           TorrentState = "forcedDL"           // Torrent is forced to downloading to ignore queue limit
	TorrentStateCheckingResumeData TorrentState = "checkingResumeData" // Checking resume data on qBt startup
	TorrentStateMoving             TorrentState = "moving"             // Torrent is moving to another location
	TorrentStateUnknown            TorrentState = "unknown"            // Unknown status
)

type TorrentTracker

type TorrentTracker struct {
	URL           string        `json:"url"`            // Tracker URL
	Status        TrackerStatus `json:"status"`         // Tracker status (see TrackerStatus enum for possible values)
	Tier          int           `json:"tier"`           // Tracker priority tier; lower tiers are tried before higher tiers
	NumPeers      int           `json:"num_peers"`      // Number of peers for the current torrent, as reported by the tracker
	NumSeeds      int           `json:"num_seeds"`      // Number of seeds for the current torrent, as reported by the tracker
	NumLeeches    int           `json:"num_leeches"`    // Number of leeches for the current torrent, as reported by the tracker
	NumDownloaded int           `json:"num_downloaded"` // Number of completed downloads for the current torrent, as reported by the tracker
	Msg           string        `json:"msg"`            // Tracker message; content depends on the tracker admins
}

type TrackerStatus

type TrackerStatus int
const (
	TrackerDisabled     TrackerStatus = 0 // Tracker is disabled (used for DHT, PeX, and LSD)
	TrackerNotContacted TrackerStatus = 1 // Tracker has not been contacted yet
	TrackerWorking      TrackerStatus = 2 // Tracker has been contacted and is working
	TrackerUpdating     TrackerStatus = 3 // Tracker is updating
	TrackerNotWorking   TrackerStatus = 4 // Tracker has been contacted, but it is not working (or doesn't send proper replies)
)

type TransferInfoResponse

type TransferInfoResponse struct {
	DLInfoSpeed       int64            `json:"dl_info_speed"`        // Global download rate in bytes per second (bytes/s)
	DLInfoData        int64            `json:"dl_info_data"`         // Data downloaded this session in bytes
	UPInfoSpeed       int64            `json:"up_info_speed"`        // Global upload rate in bytes per second (bytes/s)
	UPInfoData        int64            `json:"up_info_data"`         // Data uploaded this session in bytes
	DLRateLimit       int64            `json:"dl_rate_limit"`        // Download rate limit in bytes per second (bytes/s)
	UPRateLimit       int64            `json:"up_rate_limit"`        // Upload rate limit in bytes per second (bytes/s)
	DHTNodes          int              `json:"dht_nodes"`            // Number of DHT nodes connected to
	ConnectionStatus  ConnectionStatus `json:"connection_status"`    // Connection status (e.g., "connected", "disconnected")
	Queueing          bool             `json:"queueing"`             // True if torrent queueing is enabled
	UseAltSpeedLimits bool             `json:"use_alt_speed_limits"` // True if alternative speed limits are enabled
	RefreshInterval   int              `json:"refresh_interval"`     // Transfer list refresh interval (milliseconds)
}

type UploadChokingAlgorithm

type UploadChokingAlgorithm int
const (
	UploadChokingAlgorithmRoundRobin    UploadChokingAlgorithm = 0 // Round-robin
	UploadChokingAlgorithmFastestUpload UploadChokingAlgorithm = 1 // Fastest upload
	UploadChokingAlgorithmAntiLeech     UploadChokingAlgorithm = 2 // Anti-leech
)

type UploadSlotsBehavior

type UploadSlotsBehavior int
const (
	UploadSlotsBehaviorFixedSlots      UploadSlotsBehavior = 0 // Fixed slots
	UploadSlotsBehaviorUploadRateBased UploadSlotsBehavior = 1 // Peer proportional
)

type UtpTcpMixedMode

type UtpTcpMixedMode int
const (
	UtpTcpMixedModePreferTCP        UtpTcpMixedMode = 0
	UtpTcpMixedModePeerProportional UtpTcpMixedMode = 1
)

Jump to

Keyboard shortcuts

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