mirror of
https://github.com/simon-ding/polaris.git
synced 2026-03-06 17:40:46 +08:00
261 lines
11 KiB
Plaintext
261 lines
11 KiB
Plaintext
PACKAGE DOCUMENTATION
|
|
|
|
package qbt
|
|
import "/Users/me/Repos/go/src/go-qbittorrent/qbt"
|
|
|
|
|
|
TYPES
|
|
|
|
type BasicTorrent struct {
|
|
AddedOn int `json:"added_on"`
|
|
Category string `json:"category"`
|
|
CompletionOn int64 `json:"completion_on"`
|
|
Dlspeed int `json:"dlspeed"`
|
|
Eta int `json:"eta"`
|
|
ForceStart bool `json:"force_start"`
|
|
Hash string `json:"hash"`
|
|
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 int `json:"progress"`
|
|
Ratio int `json:"ratio"`
|
|
SavePath string `json:"save_path"`
|
|
SeqDl bool `json:"seq_dl"`
|
|
Size int `json:"size"`
|
|
State string `json:"state"`
|
|
SuperSeeding bool `json:"super_seeding"`
|
|
Upspeed int `json:"upspeed"`
|
|
}
|
|
BasicTorrent holds a basic torrent object from qbittorrent
|
|
|
|
type Client struct {
|
|
URL string
|
|
Authenticated bool
|
|
Session string //replace with session type
|
|
Jar http.CookieJar
|
|
// contains filtered or unexported fields
|
|
}
|
|
Client creates a connection to qbittorrent and performs requests
|
|
|
|
func NewClient(url string) *Client
|
|
NewClient creates a new client connection to qbittorrent
|
|
|
|
func (c *Client) AddTrackers(infoHash string, trackers string) (*http.Response, error)
|
|
AddTrackers adds trackers to a specific torrent
|
|
|
|
func (c *Client) DecreasePriority(infoHashList []string) (*http.Response, error)
|
|
DecreasePriority decreases the priority of a list of torrents
|
|
|
|
func (c *Client) DeletePermanently(infoHashList []string) (*http.Response, error)
|
|
DeletePermanently deletes all files for a list of torrents
|
|
|
|
func (c *Client) DeleteTemp(infoHashList []string) (*http.Response, error)
|
|
DeleteTemp deletes the temporary files for a list of torrents
|
|
|
|
func (c *Client) DownloadFromFile(file string, options map[string]string) (*http.Response, error)
|
|
DownloadFromFile downloads a torrent from a file
|
|
|
|
func (c *Client) DownloadFromLink(link string, options map[string]string) (*http.Response, error)
|
|
DownloadFromLink starts downloading a torrent from a link
|
|
|
|
func (c *Client) ForceStart(infoHashList []string, value bool) (*http.Response, error)
|
|
ForceStart force starts a list of torrents
|
|
|
|
func (c *Client) GetAlternativeSpeedStatus() (status bool, err error)
|
|
GetAlternativeSpeedStatus gets the alternative speed status of your
|
|
qbittorrent client
|
|
|
|
func (c *Client) GetGlobalDownloadLimit() (limit int, err error)
|
|
GetGlobalDownloadLimit gets the global download limit of your
|
|
qbittorrent client
|
|
|
|
func (c *Client) GetGlobalUploadLimit() (limit int, err error)
|
|
GetGlobalUploadLimit gets the global upload limit of your qbittorrent
|
|
client
|
|
|
|
func (c *Client) GetTorrentDownloadLimit(infoHashList []string) (limits map[string]string, err error)
|
|
GetTorrentDownloadLimit gets the download limit for a list of torrents
|
|
|
|
func (c *Client) GetTorrentUploadLimit(infoHashList []string) (limits map[string]string, err error)
|
|
GetTorrentUploadLimit gets the upload limit for a list of torrents
|
|
|
|
func (c *Client) IncreasePriority(infoHashList []string) (*http.Response, error)
|
|
IncreasePriority increases the priority of a list of torrents
|
|
|
|
func (c *Client) Login(username string, password string) (loggedIn bool, err error)
|
|
Login logs you in to the qbittorrent client
|
|
|
|
func (c *Client) Logout() (loggedOut bool, err error)
|
|
Logout logs you out of the qbittorrent client
|
|
|
|
func (c *Client) Pause(infoHash string) (*http.Response, error)
|
|
Pause pauses a specific torrent
|
|
|
|
func (c *Client) PauseAll() (*http.Response, error)
|
|
PauseAll pauses all torrents
|
|
|
|
func (c *Client) PauseMultiple(infoHashList []string) (*http.Response, error)
|
|
PauseMultiple pauses a list of torrents
|
|
|
|
func (c *Client) Recheck(infoHashList []string) (*http.Response, error)
|
|
Recheck rechecks a list of torrents
|
|
|
|
func (c *Client) Resume(infoHash string) (*http.Response, error)
|
|
Resume resumes a specific torrent
|
|
|
|
func (c *Client) ResumeAll(infoHashList []string) (*http.Response, error)
|
|
ResumeAll resumes all torrents
|
|
|
|
func (c *Client) ResumeMultiple(infoHashList []string) (*http.Response, error)
|
|
ResumeMultiple resumes a list of torrents
|
|
|
|
func (c *Client) SetCategory(infoHashList []string, category string) (*http.Response, error)
|
|
SetCategory sets the category for a list of torrents
|
|
|
|
func (c *Client) SetFilePriority(infoHash string, fileID string, priority string) (*http.Response, error)
|
|
SetFilePriority sets the priority for a specific torrent file
|
|
|
|
func (c *Client) SetGlobalDownloadLimit(limit string) (*http.Response, error)
|
|
SetGlobalDownloadLimit sets the global download limit of your
|
|
qbittorrent client
|
|
|
|
func (c *Client) SetGlobalUploadLimit(limit string) (*http.Response, error)
|
|
SetGlobalUploadLimit sets the global upload limit of your qbittorrent
|
|
client
|
|
|
|
func (c *Client) SetLabel(infoHashList []string, label string) (*http.Response, error)
|
|
SetLabel sets the labels for a list of torrents
|
|
|
|
func (c *Client) SetMaxPriority(infoHashList []string) (*http.Response, error)
|
|
SetMaxPriority sets the max priority for a list of torrents
|
|
|
|
func (c *Client) SetMinPriority(infoHashList []string) (*http.Response, error)
|
|
SetMinPriority sets the min priority for a list of torrents
|
|
|
|
func (c *Client) SetPreferences(params map[string]string) (*http.Response, error)
|
|
SetPreferences sets the preferences of your qbittorrent client
|
|
|
|
func (c *Client) SetTorrentDownloadLimit(infoHashList []string, limit string) (*http.Response, error)
|
|
SetTorrentDownloadLimit sets the download limit for a list of torrents
|
|
|
|
func (c *Client) SetTorrentUploadLimit(infoHashList []string, limit string) (*http.Response, error)
|
|
SetTorrentUploadLimit sets the upload limit of a list of torrents
|
|
|
|
func (c *Client) Shutdown() (shuttingDown bool, err error)
|
|
Shutdown shuts down the qbittorrent client
|
|
|
|
func (c *Client) Sync(rid string) (Sync, error)
|
|
Sync syncs main data of qbittorrent
|
|
|
|
func (c *Client) ToggleAlternativeSpeed() (*http.Response, error)
|
|
ToggleAlternativeSpeed toggles the alternative speed of your qbittorrent
|
|
client
|
|
|
|
func (c *Client) ToggleFirstLastPiecePriority(infoHashList []string) (*http.Response, error)
|
|
ToggleFirstLastPiecePriority toggles first last piece priority of a list
|
|
of torrents
|
|
|
|
func (c *Client) ToggleSequentialDownload(infoHashList []string) (*http.Response, error)
|
|
ToggleSequentialDownload toggles the download sequence of a list of
|
|
torrents
|
|
|
|
func (c *Client) Torrent(infoHash string) (Torrent, error)
|
|
Torrent gets a specific torrent
|
|
|
|
func (c *Client) TorrentFiles(infoHash string) ([]TorrentFile, error)
|
|
TorrentFiles gets the files of a specifc torrent
|
|
|
|
func (c *Client) TorrentTrackers(infoHash string) ([]Tracker, error)
|
|
TorrentTrackers gets all trackers for a specific torrent
|
|
|
|
func (c *Client) TorrentWebSeeds(infoHash string) ([]WebSeed, error)
|
|
TorrentWebSeeds gets seeders for a specific torrent
|
|
|
|
func (c *Client) Torrents(filters map[string]string) (torrentList []BasicTorrent, err error)
|
|
Torrents gets a list of all torrents in qbittorrent matching your filter
|
|
|
|
type Sync struct {
|
|
Categories []string `json:"categories"`
|
|
FullUpdate bool `json:"full_update"`
|
|
Rid int `json:"rid"`
|
|
ServerState struct {
|
|
ConnectionStatus string `json:"connection_status"`
|
|
DhtNodes int `json:"dht_nodes"`
|
|
DlInfoData int `json:"dl_info_data"`
|
|
DlInfoSpeed int `json:"dl_info_speed"`
|
|
DlRateLimit int `json:"dl_rate_limit"`
|
|
Queueing bool `json:"queueing"`
|
|
RefreshInterval int `json:"refresh_interval"`
|
|
UpInfoData int `json:"up_info_data"`
|
|
UpInfoSpeed int `json:"up_info_speed"`
|
|
UpRateLimit int `json:"up_rate_limit"`
|
|
UseAltSpeedLimits bool `json:"use_alt_speed_limits"`
|
|
} `json:"server_state"`
|
|
Torrents map[string]Torrent `json:"torrents"`
|
|
}
|
|
Sync holds the sync response struct
|
|
|
|
type Torrent struct {
|
|
AdditionDate int `json:"addition_date"`
|
|
Comment string `json:"comment"`
|
|
CompletionDate int `json:"completion_date"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreationDate int `json:"creation_date"`
|
|
DlLimit int `json:"dl_limit"`
|
|
DlSpeed int `json:"dl_speed"`
|
|
DlSpeedAvg int `json:"dl_speed_avg"`
|
|
Eta int `json:"eta"`
|
|
LastSeen int `json:"last_seen"`
|
|
NbConnections int `json:"nb_connections"`
|
|
NbConnectionsLimit int `json:"nb_connections_limit"`
|
|
Peers int `json:"peers"`
|
|
PeersTotal int `json:"peers_total"`
|
|
PieceSize int `json:"piece_size"`
|
|
PiecesHave int `json:"pieces_have"`
|
|
PiecesNum int `json:"pieces_num"`
|
|
Reannounce int `json:"reannounce"`
|
|
SavePath string `json:"save_path"`
|
|
SeedingTime int `json:"seeding_time"`
|
|
Seeds int `json:"seeds"`
|
|
SeedsTotal int `json:"seeds_total"`
|
|
ShareRatio float64 `json:"share_ratio"`
|
|
TimeElapsed int `json:"time_elapsed"`
|
|
TotalDownloaded int `json:"total_downloaded"`
|
|
TotalDownloadedSession int `json:"total_downloaded_session"`
|
|
TotalSize int `json:"total_size"`
|
|
TotalUploaded int `json:"total_uploaded"`
|
|
TotalUploadedSession int `json:"total_uploaded_session"`
|
|
TotalWasted int `json:"total_wasted"`
|
|
UpLimit int `json:"up_limit"`
|
|
UpSpeed int `json:"up_speed"`
|
|
UpSpeedAvg int `json:"up_speed_avg"`
|
|
}
|
|
Torrent holds a torrent object from qbittorrent
|
|
|
|
type TorrentFile struct {
|
|
IsSeed bool `json:"is_seed"`
|
|
Name string `json:"name"`
|
|
Priority int `json:"priority"`
|
|
Progress int `json:"progress"`
|
|
Size int `json:"size"`
|
|
}
|
|
TorrentFile holds a torrent file object from qbittorrent
|
|
|
|
type Tracker struct {
|
|
Msg string `json:"msg"`
|
|
NumPeers int `json:"num_peers"`
|
|
Status string `json:"status"`
|
|
URL string `json:"url"`
|
|
}
|
|
Tracker holds a tracker object from qbittorrent
|
|
|
|
type WebSeed struct {
|
|
URL string `json:"url"`
|
|
}
|
|
WebSeed holds a webseed object from qbittorrent
|
|
|
|
|