qbit

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotLogin = wrapper.New("Please Login First")

Functions

func FailedToBuildRequest

func FailedToBuildRequest(err error) error

func FailedToDecodeResponse

func FailedToDecodeResponse(err error) error

func RequestFailed

func RequestFailed(err error) error

Types

type Client

type Client struct {
	HTTPClient *http.Client
	Authed     bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string) *Client

func (*Client) AddTags

func (client *Client) AddTags(h, tags string) error

func (*Client) AddTorrentWithFile

func (client *Client) AddTorrentWithFile(torrentFiles []string, savePath, category string) error
func (client *Client) AddTorrentWithLink(torrentURLs []string, savePath, category string) error

func (*Client) BanPeers

func (client *Client) BanPeers(peers string) error

func (*Client) BottomPrio

func (client *Client) BottomPrio(h string) error

func (*Client) CreateTags

func (client *Client) CreateTags(tags string) error

func (*Client) DecreasePrio

func (client *Client) DecreasePrio(h string) error

func (*Client) DeleteTags

func (client *Client) DeleteTags(tags string) error

func (*Client) DeleteTorrent

func (client *Client) DeleteTorrent(hashes string, deleteFiles bool) error

func (*Client) DownloadLimit

func (client *Client) DownloadLimit(h string) (map[string]int, error)

func (*Client) EditCategory

func (client *Client) EditCategory(category, savePath string) error

func (*Client) FilePrio

func (client *Client) FilePrio(h, id string, priority int) error

func (*Client) Files

func (client *Client) Files(hash string, indexes string) ([]File, error)

func (*Client) Get

func (client *Client) Get(endpoint string, opts map[string]string) (*http.Response, error)

func (*Client) GetBuildInfo

func (client *Client) GetBuildInfo() (map[string]interface{}, error)

func (*Client) GetCategories

func (client *Client) GetCategories() (map[string]struct {
	Name     string `json:"name"`
	SavePath string `json:"savePath"`
}, error)

func (*Client) GetGlobalDownloadLimit

func (client *Client) GetGlobalDownloadLimit() (int, error)

func (*Client) GetGlobalUploadLimit

func (client *Client) GetGlobalUploadLimit() (int, error)

func (*Client) GetLogMain

func (c *Client) GetLogMain(normal, info, warning, critical bool, lastKnownID int) ([]LogMessage, error)

func (*Client) GetLogPeers

func (c *Client) GetLogPeers(lastKnownID int) ([]PeerLog, error)

func (*Client) GetPreferences

func (client *Client) GetPreferences() (Preferences, error)

func (*Client) GetSpeedLimitsMode

func (client *Client) GetSpeedLimitsMode() (int, error)

func (*Client) GetTags

func (client *Client) GetTags() ([]string, error)

func (*Client) GetTransferInfo

func (client *Client) GetTransferInfo() (*TransferInfo, error)

func (*Client) GetUploadLimit

func (client *Client) GetUploadLimit(limit int) error

func (*Client) GetVersion

func (client *Client) GetVersion() (string, error)

func (*Client) GetWebAPIVersion

func (client *Client) GetWebAPIVersion() (string, error)

func (*Client) IncreasePrio

func (client *Client) IncreasePrio(hashes string) error

func (*Client) List

func (client *Client) List(opts map[string]string) ([]Torrent, error)

func (*Client) Login

func (client *Client) Login(username string, password string) error

func (*Client) Logout

func (client *Client) Logout() error

func (*Client) PieceStates

func (client *Client) PieceStates(hash string) ([]int, error)

func (*Client) Post

func (client *Client) Post(endpoint string, opts map[string]string) (*http.Response, error)

func (*Client) PostFileWithForm

func (client *Client) PostFileWithForm(endpoint string, formData map[string]string, fileFieldName, filePath string) (*http.Response, error)

func (*Client) PostFormData

func (client *Client) PostFormData(endpoint string, formData map[string]string) (*http.Response, error)

func (*Client) PostURL

func (client *Client) PostURL(endpoint string, opts map[string]string) (*http.Response, error)

func (*Client) Properties

func (client *Client) Properties(hash string) (TorrentGeneric, error)

func (*Client) RemoveCategories

func (client *Client) RemoveCategories(categories string) error

func (*Client) RemoveTags

func (client *Client) RemoveTags(h, tags string) error

func (*Client) RenameFile

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

func (*Client) RenameFolder

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

func (*Client) SearchDelete

func (client *Client) SearchDelete(id int) error

func (*Client) SearchEnablePlugin

func (client *Client) SearchEnablePlugin(names string, enable bool) error

func (*Client) SearchInstallPlugin

func (client *Client) SearchInstallPlugin(sources string) error

func (*Client) SearchPlugins

func (client *Client) SearchPlugins() ([]SearchPlugin, error)

func (*Client) SearchResults

func (client *Client) SearchResults(id, limit, offset int) (SearchResult, error)

func (*Client) SearchStart

func (client *Client) SearchStart(pattern, plugins, category string) (int, error)

func (*Client) SearchStatus

func (client *Client) SearchStatus(id *int) ([]SearchJobStatus, error)

func (*Client) SearchStop

func (client *Client) SearchStop(id int) error

func (*Client) SearchUninstallPlugin

func (client *Client) SearchUninstallPlugin(names string) error

func (*Client) SearchUpdatePlugins

func (client *Client) SearchUpdatePlugins() error

func (*Client) SetCategory

func (client *Client) SetCategory(h, category string) error

func (*Client) SetDownloadLimit

func (client *Client) SetDownloadLimit(h string, limit int) error

func (*Client) SetForceStart

func (client *Client) SetForceStart(hashes string, value bool) error

func (*Client) SetGlobalDownloadLimit

func (client *Client) SetGlobalDownloadLimit(limit int) error

func (*Client) SetLocation

func (client *Client) SetLocation(h string, location string) error

func (*Client) SetPreferences

func (client *Client) SetPreferences(pref map[string]string) error

func (*Client) SetShareLimits

func (client *Client) SetShareLimits(h string, ratioLimit float64, seedingTimeLimit int, inactiveSeedingTimeLimit int) error

func (*Client) SetSuperSeeding

func (client *Client) SetSuperSeeding(hashes string, value bool) error

func (*Client) ToggleFirstLastPiecePrio

func (client *Client) ToggleFirstLastPiecePrio(hashes string) error

func (*Client) ToggleSpeedLimitsMode

func (client *Client) ToggleSpeedLimitsMode() error

func (*Client) TopPrio

func (client *Client) TopPrio(h string) error

func (*Client) Trackers

func (client *Client) Trackers(hash string) ([]Tracker, error)

func (*Client) UploadLimit

func (client *Client) UploadLimit(h string) (map[string]int, error)

func (*Client) WebSeeds

func (client *Client) WebSeeds(hash string) ([]string, error)

type File

type File struct {
	Index        int     `json:"index"`
	Name         string  `json:"name"`
	Size         int64   `json:"size"`
	Progress     float64 `json:"progress"`
	Priority     int     `json:"priority"`
	IsSeed       bool    `json:"is_seed"`
	PieceRange   []int   `json:"piece_range"`
	Availability float64 `json:"availability"`
}

type LogMessage

type LogMessage struct {
	ID        int    `json:"id"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
	Type      int    `json:"type"`
}

type LogType

type LogType int
const (
	LogNormal   LogType = 1
	LogInfo     LogType = 2
	LogWarning  LogType = 4
	LogCritical LogType = 8
)

type PeerLog

type PeerLog struct {
	ID        int    `json:"id"`
	IP        string `json:"ip"`
	Timestamp int64  `json:"timestamp"`
	Blocked   bool   `json:"blocked"`
	Reason    string `json:"reason"`
}

type Preferences

type Preferences struct {
	AddTrackers                      string         `json:"add_trackers"`
	AddTrackersEnabled               bool           `json:"add_trackers_enabled"`
	AltDlLimit                       int            `json:"alt_dl_limit"`
	AltUpLimit                       int            `json:"alt_up_limit"`
	AlternativeWebuiEnabled          bool           `json:"alternative_webui_enabled"`
	AlternativeWebuiPath             string         `json:"alternative_webui_path"`
	AnnounceIP                       string         `json:"announce_ip"`
	AnnounceToAllTiers               bool           `json:"announce_to_all_tiers"`
	AnnounceToAllTrackers            bool           `json:"announce_to_all_trackers"`
	AnonymousMode                    bool           `json:"anonymous_mode"`
	AsyncIOThreads                   int            `json:"async_io_threads"`
	AutoDeleteMode                   int            `json:"auto_delete_mode"`
	AutoTMMEnabled                   bool           `json:"auto_tmm_enabled"`
	AutorunEnabled                   bool           `json:"autorun_enabled"`
	AutorunProgram                   string         `json:"autorun_program"`
	BannedIPs                        string         `json:"banned_IPs"`
	BittorrentProtocol               int            `json:"bittorrent_protocol"`
	ByPassAuthSubnetWhitelist        string         `json:"bypass_auth_subnet_whitelist"`
	ByPassAuthSubnetWhitelistEnabled bool           `json:"bypass_auth_subnet_whitelist_enabled"`
	ByPassLocalAuth                  bool           `json:"bypass_local_auth"`
	CategoryChangedTMMEnabled        bool           `json:"category_changed_tmm_enabled"`
	CheckingMemoryUse                int            `json:"checking_memory_use"`
	CreateSubfolderEnabled           bool           `json:"create_subfolder_enabled"`
	CurrentInterfaceAddress          string         `json:"current_interface_address"`
	CurrentNetworkInterface          string         `json:"current_network_interface"`
	DHT                              bool           `json:"dht"`
	DiskCache                        int            `json:"disk_cache"`
	DiskCacheTTL                     int            `json:"disk_cache_ttl"`
	DLLimit                          int            `json:"dl_limit"`
	DontCountSlowTorrents            bool           `json:"dont_count_slow_torrents"`
	DyndnsDomain                     string         `json:"dyndns_domain"`
	DyndnsEnabled                    bool           `json:"dyndns_enabled"`
	DyndnsPassword                   string         `json:"dyndns_password"`
	DyndnsService                    int            `json:"dyndns_service"`
	DyndnsUsername                   string         `json:"dyndns_username"`
	EmbeddedTrackerPort              int            `json:"embedded_tracker_port"`
	EnableCoalesceReadWrite          bool           `json:"enable_coalesce_read_write"`
	EnableEmbeddedTracker            bool           `json:"enable_embedded_tracker"`
	EnableMultiConnectionsFromSameIP bool           `json:"enable_multi_connections_from_same_ip"`
	EnableOSCache                    bool           `json:"enable_os_cache"`
	EnablePieceExtentAffinity        bool           `json:"enable_piece_extent_affinity"`
	EnableUploadSuggestions          bool           `json:"enable_upload_suggestions"`
	Encryption                       int            `json:"encryption"`
	ExportDir                        string         `json:"export_dir"`
	ExportDirFin                     string         `json:"export_dir_fin"`
	FilePoolSize                     int            `json:"file_pool_size"`
	IncompleteFilesExt               bool           `json:"incomplete_files_ext"`
	IPFilterEnabled                  bool           `json:"ip_filter_enabled"`
	IPFilterPath                     string         `json:"ip_filter_path"`
	IPFilterTrackers                 bool           `json:"ip_filter_trackers"`
	LimitLANPeers                    bool           `json:"limit_lan_peers"`
	LimitTCPOverhead                 bool           `json:"limit_tcp_overhead"`
	LimitUTPRate                     bool           `json:"limit_utp_rate"`
	ListenPort                       int            `json:"listen_port"`
	Locale                           string         `json:"locale"`
	LSD                              bool           `json:"lsd"`
	MailNotificationAuthEnabled      bool           `json:"mail_notification_auth_enabled"`
	MailNotificationEmail            string         `json:"mail_notification_email"`
	MailNotificationEnabled          bool           `json:"mail_notification_enabled"`
	MailNotificationPassword         string         `json:"mail_notification_password"`
	MailNotificationSender           string         `json:"mail_notification_sender"`
	MailNotificationSMTP             string         `json:"mail_notification_smtp"`
	MailNotificationSSLEnabled       bool           `json:"mail_notification_ssl_enabled"`
	MailNotificationUsername         string         `json:"mail_notification_username"`
	MaxActiveDownloads               int            `json:"max_active_downloads"`
	MaxActiveTorrents                int            `json:"max_active_torrents"`
	MaxActiveUploads                 int            `json:"max_active_uploads"`
	MaxConnec                        int            `json:"max_connec"`
	MaxConnecPerTorrent              int            `json:"max_connec_per_torrent"`
	MaxRatio                         float64        `json:"max_ratio"`
	MaxRatioAct                      int            `json:"max_ratio_act"`
	MaxRatioEnabled                  bool           `json:"max_ratio_enabled"`
	MaxSeedingTime                   int            `json:"max_seeding_time"`
	MaxSeedingTimeEnabled            bool           `json:"max_seeding_time_enabled"`
	MaxUploads                       int            `json:"max_uploads"`
	MaxUploadsPerTorrent             int            `json:"max_uploads_per_torrent"`
	OutgoingPortsMax                 int            `json:"outgoing_ports_max"`
	OutgoingPortsMin                 int            `json:"outgoing_ports_min"`
	PEX                              bool           `json:"pex"`
	PreallocateAll                   bool           `json:"preallocate_all"`
	ProxyAuthEnabled                 bool           `json:"proxy_auth_enabled"`
	ProxyIP                          string         `json:"proxy_ip"`
	ProxyPassword                    string         `json:"proxy_password"`
	ProxyPeerConnections             bool           `json:"proxy_peer_connections"`
	ProxyPort                        int            `json:"proxy_port"`
	ProxyTorrentsOnly                bool           `json:"proxy_torrents_only"`
	ProxyType                        int            `json:"proxy_type"`
	ProxyUsername                    string         `json:"proxy_username"`
	QueueingEnabled                  bool           `json:"queueing_enabled"`
	RandomPort                       bool           `json:"random_port"`
	RecheckCompletedTorrents         bool           `json:"recheck_completed_torrents"`
	ResolvePeerCountries             bool           `json:"resolve_peer_countries"`
	RSSAutoDownloadingEnabled        bool           `json:"rss_auto_downloading_enabled"`
	RSSDownloadRepackProperEpisodes  bool           `json:"rss_download_repack_proper_episodes"`
	RSSMaxArticlesPerFeed            int            `json:"rss_max_articles_per_feed"`
	RSSProcessingEnabled             bool           `json:"rss_processing_enabled"`
	RSSRefreshInterval               int            `json:"rss_refresh_interval"`
	RSSSmartEpisodeFilters           string         `json:"rss_smart_episode_filters"`
	SavePath                         string         `json:"save_path"`
	SavePathChangedTMMEnabled        bool           `json:"save_path_changed_tmm_enabled"`
	SaveResumeDataInterval           int            `json:"save_resume_data_interval"`
	ScanDirs                         map[string]int `json:"scan_dirs"`
	SchedulerEnabled                 bool           `json:"scheduler_enabled"`
	SchedulerDays                    int            `json:"scheduler_days"`
	ScheduleFromHour                 int            `json:"schedule_from_hour"`
	ScheduleFromMin                  int            `json:"schedule_from_min"`
	ScheduleToHour                   int            `json:"schedule_to_hour"`
	ScheduleToMin                    int            `json:"schedule_to_min"`
	SendBufferLowWatermark           int            `json:"send_buffer_low_watermark"`
	SendBufferWatermark              int            `json:"send_buffer_watermark"`
	SendBufferWatermarkFactor        int            `json:"send_buffer_watermark_factor"`
	SlowTorrentDLRateThreshold       int            `json:"slow_torrent_dl_rate_threshold"`
	SlowTorrentInactiveTimer         int            `json:"slow_torrent_inactive_timer"`
	SlowTorrentULRateThreshold       int            `json:"slow_torrent_ul_rate_threshold"`
	SocketBacklogSize                int            `json:"socket_backlog_size"`
	StartPausedEnabled               bool           `json:"start_paused_enabled"`
	StopTrackerTimeout               int            `json:"stop_tracker_timeout"`
	TempPath                         string         `json:"temp_path"`
	TempPathEnabled                  bool           `json:"temp_path_enabled"`
	TorrentChangedTMMEnabled         bool           `json:"torrent_changed_tmm_enabled"`
	UpLimit                          int            `json:"up_limit"`
	UploadChokingAlgorithm           int            `json:"upload_choking_algorithm"`
}

type SearchJobStatus

type SearchJobStatus struct {
	ID     int    `json:"id"`
	Status string `json:"status"`
	Total  int    `json:"total"`
}

type SearchPlugin

type SearchPlugin struct {
	Enabled             bool   `json:"enabled"`
	FullName            string `json:"fullName"`
	Name                string `json:"name"`
	URL                 string `json:"url"`
	Version             string `json:"version"`
	SupportedCategories []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"supportedCategories"`
}

type SearchResult

type SearchResult struct {
	Results []struct {
		DescrLink string `json:"descrLink"`
		FileName  string `json:"fileName"`
		FileSize  int64  `json:"fileSize"`
		FileURL   string `json:"fileUrl"`
		Leechers  int    `json:"nbLeechers"`
		Seeders   int    `json:"nbSeeders"`
		SiteURL   string `json:"siteUrl"`
	} `json:"results"`
	Status string `json:"status"`
	Total  int    `json:"total"`
}

type Torrent

type Torrent struct {
	AddedOn           int     `json:"added_on"`
	AmountLeft        int     `json:"amount_left"`
	AutoTMM           bool    `json:"auto_tmm"`
	Availability      float64 `json:"availability"`
	Category          string  `json:"category"`
	Completed         int     `json:"completed"`
	CompletionOn      int     `json:"completion_on"`
	ContentPath       string  `json:"content_path"`
	DlLimit           int     `json:"dl_limit"`
	Dlspeed           int     `json:"dlspeed"`
	Downloaded        int     `json:"downloaded"`
	DownloadedSession int     `json:"downloaded_session"`
	Eta               int     `json:"eta"`
	FLPiecePrio       bool    `json:"f_l_piece_prio"`
	ForceStart        bool    `json:"force_start"`
	Hash              string  `json:"hash"`
	IsPrivate         bool    `json:"isPrivate"`
	LastActivity      int     `json:"last_activity"`
	MagnetURI         string  `json:"magnet_uri"`
	MaxRatio          float64 `json:"max_ratio"`
	MaxSeedingTime    int     `json:"max_seeding_time"`
	Name              string  `json:"name"`
	NumComplete       int     `json:"num_complete"`
	NumIncomplete     int     `json:"num_incomplete"`
	NumLeechs         int     `json:"num_leechs"`
	NumSeeds          int     `json:"num_seeds"`
	Priority          int     `json:"priority"`
	Progress          float64 `json:"progress"`
	Ratio             float64 `json:"ratio"`
	RatioLimit        float64 `json:"ratio_limit"`
	SavePath          string  `json:"save_path"`
	SeedingTime       int     `json:"seeding_time"`
	SeedingTimeLimit  int     `json:"seeding_time_limit"`
	SeenComplete      int     `json:"seen_complete"`
	SeqDL             bool    `json:"seq_dl"`
	Size              int     `json:"size"`
	State             string  `json:"state"`
	SuperSeeding      bool    `json:"super_seeding"`
	Tags              string  `json:"tags"`
	TimeActive        int     `json:"time_active"`
	TotalSize         int     `json:"total_size"`
	Tracker           string  `json:"tracker"`
	UpLimit           int     `json:"up_limit"`
	Uploaded          int     `json:"uploaded"`
	UploadedSession   int     `json:"uploaded_session"`
	Upspeed           int     `json:"upspeed"`
}

type TorrentGeneric

type TorrentGeneric struct {
	SavePath               string  `json:"save_path"`
	CreationDate           int     `json:"creation_date"`
	PieceSize              int     `json:"piece_size"`
	Comment                string  `json:"comment"`
	TotalWasted            int     `json:"total_wasted"`
	TotalUploaded          int     `json:"total_uploaded"`
	TotalUploadedSession   int     `json:"total_uploaded_session"`
	TotalDownloaded        int     `json:"total_downloaded"`
	TotalDownloadedSession int     `json:"total_downloaded_session"`
	UpLimit                int     `json:"up_limit"`
	DlLimit                int     `json:"dl_limit"`
	TimeElapsed            int     `json:"time_elapsed"`
	SeedingTime            int     `json:"seeding_time"`
	NbConnections          int     `json:"nb_connections"`
	NbConnectionsLimit     int     `json:"nb_connections_limit"`
	ShareRatio             float64 `json:"share_ratio"`
	AdditionDate           int     `json:"addition_date"`
	CompletionDate         int     `json:"completion_date"`
	CreatedBy              string  `json:"created_by"`
	DlSpeedAvg             int     `json:"dl_speed_avg"`
	DlSpeed                int     `json:"dl_speed"`
	Eta                    int     `json:"eta"`
	LastSeen               int     `json:"last_seen"`
	Peers                  int     `json:"peers"`
	PeersTotal             int     `json:"peers_total"`
	PiecesHave             int     `json:"pieces_have"`
	PiecesNum              int     `json:"pieces_num"`
	Reannounce             int     `json:"reannounce"`
	Seeds                  int     `json:"seeds"`
	SeedsTotal             int     `json:"seeds_total"`
	TotalSize              int     `json:"total_size"`
	UpSpeedAvg             int     `json:"up_speed_avg"`
	UpSpeed                int     `json:"up_speed"`
	IsPrivate              bool    `json:"isPrivate"`
}

type Tracker

type Tracker struct {
	URL           string `json:"url"`
	Status        int    `json:"status"`
	Tier          int    `json:"tier"`
	NumPeers      int    `json:"num_peers"`
	NumSeeds      int    `json:"num_seeds"`
	NumLeeches    int    `json:"num_leeches"`
	NumDownloaded int    `json:"num_downloaded"`
	Msg           string `json:"msg"`
}

type TransferInfo

type TransferInfo struct {
	DlInfoSpeed      int    `json:"dl_info_speed"`
	DlInfoData       int    `json:"dl_info_data"`
	UpInfoSpeed      int    `json:"up_info_speed"`
	UpInfoData       int    `json:"up_info_data"`
	DlRateLimit      int    `json:"dl_rate_limit"`
	UpRateLimit      int    `json:"up_rate_limit"`
	DhtNodes         int    `json:"dht_nodes"`
	ConnectionStatus string `json:"connection_status"`
}

Jump to

Keyboard shortcuts

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