Documentation
¶
Index ¶
- Constants
- Variables
- type Category
- type Client
- func (c *Client) AddTorrentFromFile(filePath string, options map[string]string) error
- func (c *Client) AddTorrentFromFileCtx(ctx context.Context, filePath string, options map[string]string) error
- func (c *Client) AddTorrentFromUrl(url string, options map[string]string) error
- func (c *Client) AddTorrentFromUrlCtx(ctx context.Context, url string, options map[string]string) error
- func (c *Client) CreateCategory(category string, path string) error
- func (c *Client) CreateCategoryCtx(ctx context.Context, category string, path string) error
- func (c *Client) DeleteTorrents(hashes []string, deleteFiles bool) error
- func (c *Client) DeleteTorrentsCtx(ctx context.Context, hashes []string, deleteFiles bool) error
- func (c *Client) EditCategory(category string, path string) error
- func (c *Client) EditCategoryCtx(ctx context.Context, category string, path string) error
- func (c *Client) GetCategories() (map[string]Category, error)
- func (c *Client) GetCategoriesCtx(ctx context.Context) (map[string]Category, error)
- func (c *Client) GetFilesInformation(hash string) (*TorrentFiles, error)
- func (c *Client) GetFilesInformationCtx(ctx context.Context, hash string) (*TorrentFiles, error)
- func (c *Client) GetTorrentTrackers(hash string) ([]TorrentTracker, error)
- func (c *Client) GetTorrentTrackersCtx(ctx context.Context, hash string) ([]TorrentTracker, error)
- func (c *Client) GetTorrents(o TorrentFilterOptions) ([]Torrent, error)
- func (c *Client) GetTorrentsActiveDownloads() ([]Torrent, error)
- func (c *Client) GetTorrentsActiveDownloadsCtx(ctx context.Context) ([]Torrent, error)
- func (c *Client) GetTorrentsCtx(ctx context.Context, o TorrentFilterOptions) ([]Torrent, error)
- func (c *Client) GetTorrentsRaw() (string, error)
- func (c *Client) GetTorrentsRawCtx(ctx context.Context) (string, error)
- func (c *Client) GetTransferInfo() (*TransferInfo, error)
- func (c *Client) GetTransferInfoCtx(ctx context.Context) (*TransferInfo, error)
- func (c *Client) Login() error
- func (c *Client) LoginCtx(ctx context.Context) error
- func (c *Client) Pause(hashes []string) error
- func (c *Client) PauseCtx(ctx context.Context, hashes []string) error
- func (c *Client) ReAnnounceTorrents(hashes []string) error
- func (c *Client) ReAnnounceTorrentsCtx(ctx context.Context, hashes []string) error
- func (c *Client) ReannounceTorrentWithRetry(ctx context.Context, opts ReannounceOptions, hash string) error
- func (c *Client) Recheck(hashes []string) error
- func (c *Client) RecheckCtx(ctx context.Context, hashes []string) error
- func (c *Client) RemoveCategories(categories []string) error
- func (c *Client) RemoveCategoriesCtx(ctx context.Context, categories []string) error
- func (c *Client) RenameFile(hash, oldPath, newPath string) error
- func (c *Client) RenameFileCtx(ctx context.Context, hash, oldPath, newPath string) error
- func (c *Client) Resume(hashes []string) error
- func (c *Client) ResumeCtx(ctx context.Context, hashes []string) error
- func (c *Client) SetAutoManagement(hashes []string, enable bool) error
- func (c *Client) SetAutoManagementCtx(ctx context.Context, hashes []string, enable bool) error
- func (c *Client) SetCategory(hashes []string, category string) error
- func (c *Client) SetCategoryCtx(ctx context.Context, hashes []string, category string) error
- func (c *Client) SetForceStart(hashes []string, value bool) error
- func (c *Client) SetForceStartCtx(ctx context.Context, hashes []string, value bool) error
- func (c *Client) SetLocation(hashes []string, location string) error
- func (c *Client) SetLocationCtx(ctx context.Context, hashes []string, location string) error
- type Config
- type ConnectionStatus
- type ContentLayout
- type ReannounceOptions
- type Torrent
- type TorrentAddOptions
- type TorrentFiles
- type TorrentFilter
- type TorrentFilterOptions
- type TorrentState
- type TorrentTracker
- type TorrentTrackersResponse
- type TrackerStatus
- type TransferInfo
Constants ¶
const ( ConnectionStatusConnected = "connected" ConnectionStatusFirewalled = "firewalled" ConnectionStatusDisconnected = "disconnected" )
const ( ReannounceMaxAttempts = 50 ReannounceInterval = 7000 )
Variables ¶
var (
DefaultTimeout = 60 * time.Second
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddTorrentFromFile ¶
AddTorrentFromFile add new torrent from torrent file
func (*Client) AddTorrentFromFileCtx ¶
func (*Client) AddTorrentFromUrl ¶
AddTorrentFromUrl add new torrent from torrent file
func (*Client) AddTorrentFromUrlCtx ¶
func (*Client) CreateCategoryCtx ¶
func (*Client) DeleteTorrents ¶
func (*Client) DeleteTorrentsCtx ¶
func (*Client) EditCategoryCtx ¶
func (*Client) GetCategoriesCtx ¶
func (*Client) GetFilesInformation ¶
func (c *Client) GetFilesInformation(hash string) (*TorrentFiles, error)
func (*Client) GetFilesInformationCtx ¶
func (*Client) GetTorrentTrackers ¶
func (c *Client) GetTorrentTrackers(hash string) ([]TorrentTracker, error)
func (*Client) GetTorrentTrackersCtx ¶
func (*Client) GetTorrents ¶
func (c *Client) GetTorrents(o TorrentFilterOptions) ([]Torrent, error)
func (*Client) GetTorrentsActiveDownloads ¶
func (*Client) GetTorrentsActiveDownloadsCtx ¶
func (*Client) GetTorrentsCtx ¶
func (*Client) GetTorrentsRaw ¶
func (*Client) GetTorrentsRawCtx ¶
func (*Client) GetTransferInfo ¶
func (c *Client) GetTransferInfo() (*TransferInfo, error)
func (*Client) GetTransferInfoCtx ¶
func (c *Client) GetTransferInfoCtx(ctx context.Context) (*TransferInfo, error)
func (*Client) Login ¶
Login https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#authentication
func (*Client) ReAnnounceTorrents ¶
func (*Client) ReAnnounceTorrentsCtx ¶
func (*Client) ReannounceTorrentWithRetry ¶ added in v1.1.0
func (*Client) RemoveCategories ¶
func (*Client) RemoveCategoriesCtx ¶
func (*Client) RenameFile ¶
func (*Client) RenameFileCtx ¶
func (*Client) SetAutoManagement ¶
func (*Client) SetAutoManagementCtx ¶
func (*Client) SetCategoryCtx ¶
func (*Client) SetForceStartCtx ¶
type ConnectionStatus ¶
type ConnectionStatus string
type ContentLayout ¶
type ContentLayout string
const ( ContentLayoutOriginal ContentLayout = "Original" ContentLayoutSubfolderNone ContentLayout = "NoSubfolder" ContentLayoutSubfolderCreate ContentLayout = "Subfolder" )
type ReannounceOptions ¶ added in v1.1.0
type Torrent ¶
type Torrent struct { AddedOn int `json:"added_on"` AmountLeft int `json:"amount_left"` AutoManaged bool `json:"auto_tmm"` Availability float32 `json:"availability"` Category string `json:"category"` Completed int `json:"completed"` CompletionOn int `json:"completion_on"` DlLimit int `json:"dl_limit"` DlSpeed int `json:"dl_speed"` Downloaded int `json:"downloaded"` DownloadedSession int `json:"downloaded_session"` ETA int `json:"eta"` FirstLastPiecePrio bool `json:"f_l_piece_prio"` ForceStart bool `json:"force_start"` Hash string `json:"hash"` LastActivity int `json:"last_activity"` MagnetURI string `json:"magnet_uri"` MaxRatio float32 `json:"max_ratio"` MaxSeedingTime int `json:"max_seeding_time"` Name string `json:"name"` NumComplete int `json:"num_complete"` NumIncomplete int `json:"num_incomplete"` NumSeeds int `json:"num_seeds"` Priority int `json:"priority"` Progress float32 `json:"progress"` Ratio float32 `json:"ratio"` RatioLimit float32 `json:"ratio_limit"` SavePath string `json:"save_path"` SeedingTimeLimit int `json:"seeding_time_limit"` SeenComplete int `json:"seen_complete"` SequentialDownload bool `json:"seq_dl"` Size int `json:"size"` State TorrentState `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 TorrentAddOptions ¶
type TorrentAddOptions struct { Paused bool SkipHashCheck bool ContentLayout ContentLayout SavePath string AutoTMM bool Category string Tags string LimitUploadSpeed int64 LimitDownloadSpeed int64 LimitRatio float64 LimitSeedTime int64 }
func (*TorrentAddOptions) Prepare ¶
func (o *TorrentAddOptions) Prepare() map[string]string
type TorrentFiles ¶
type TorrentFilter ¶
type TorrentFilter string
const ( // Torrent is paused TorrentFilterAll TorrentFilter = "all" // Torrent is active TorrentFilterActive TorrentFilter = "active" // Torrent is inactive TorrentFilterInactive TorrentFilter = "inactive" // Torrent is completed TorrentFilterCompleted TorrentFilter = "completed" // Torrent is resumed TorrentFilterResumed TorrentFilter = "resumed" // Torrent is paused TorrentFilterPaused TorrentFilter = "paused" // Torrent is stalled TorrentFilterStalled TorrentFilter = "stalled" // Torrent is being seeded and data is being transferred TorrentFilterUploading TorrentFilter = "uploading" // Torrent is being seeded, but no connection were made TorrentFilterStalledUploading TorrentFilter = "stalled_uploading" // Torrent is being downloaded and data is being transferred TorrentFilterDownloading TorrentFilter = "downloading" // Torrent is being downloaded, but no connection were made TorrentFilterStalledDownloading TorrentFilter = "stalled_downloading" // Torrent is errored TorrentFilterError TorrentFilter = "errored" )
type TorrentFilterOptions ¶
type TorrentState ¶
type TorrentState string
const ( // Some error occurred, applies to paused torrents TorrentStateError TorrentState = "error" // Torrent data files is missing TorrentStateMissingFiles TorrentState = "missingFiles" // Torrent is being seeded and data is being transferred TorrentStateUploading TorrentState = "uploading" // Torrent is paused and has finished downloading TorrentStatePausedUp TorrentState = "pausedUP" // Queuing is enabled and torrent is queued for upload TorrentStateQueuedUp TorrentState = "queuedUP" // Torrent is being seeded, but no connection were made TorrentStateStalledUp TorrentState = "stalledUP" // Torrent has finished downloading and is being checked TorrentStateCheckingUp TorrentState = "checkingUP" // Torrent is forced to uploading and ignore queue limit TorrentStateForcedUp TorrentState = "forcedUP" // Torrent is allocating disk space for download TorrentStateAllocating TorrentState = "allocating" // Torrent is being downloaded and data is being transferred TorrentStateDownloading TorrentState = "downloading" // Torrent has just started downloading and is fetching metadata TorrentStateMetaDl TorrentState = "metaDL" // Torrent is paused and has NOT finished downloading TorrentStatePausedDl TorrentState = "pausedDL" // Queuing is enabled and torrent is queued for download TorrentStateQueuedDl TorrentState = "queuedDL" // Torrent is being downloaded, but no connection were made TorrentStateStalledDl TorrentState = "stalledDL" // Same as checkingUP, but torrent has NOT finished downloading TorrentStateCheckingDl TorrentState = "checkingDL" // Torrent is forced to downloading to ignore queue limit TorrentStateForcedDl TorrentState = "forcedDL" // Checking resume data on qBt startup TorrentStateCheckingResumeData TorrentState = "checkingResumeData" // Torrent is moving to another location TorrentStateMoving TorrentState = "moving" // Unknown status TorrentStateUnknown TorrentState = "unknown" )
type TorrentTracker ¶
type TorrentTracker struct { //Tier int `json:"tier"` // can be both empty "" and int Url string `json:"url"` Status TrackerStatus `json:"status"` NumPeers int `json:"num_peers"` NumSeeds int `json:"num_seeds"` NumLeechers int `json:"num_leechers"` NumDownloaded int `json:"num_downloaded"` Message string `json:"msg"` }
type TorrentTrackersResponse ¶
type TorrentTrackersResponse struct {
Trackers []TorrentTracker `json:"trackers"`
}
type TrackerStatus ¶
type TrackerStatus int
TrackerStatus https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-trackers
const ( // 0 Tracker is disabled (used for DHT, PeX, and LSD) TrackerStatusDisabled TrackerStatus = 0 // 1 Tracker has not been contacted yet TrackerStatusNotContacted TrackerStatus = 1 // 2 Tracker has been contacted and is working TrackerStatusOK TrackerStatus = 2 // 3 Tracker is updating TrackerStatusUpdating TrackerStatus = 3 // 4 Tracker has been contacted, but it is not working (or doesn't send proper replies) TrackerStatusNotWorking TrackerStatus = 4 )
type TransferInfo ¶
type TransferInfo struct { ConnectionStatus ConnectionStatus `json:"connection_status"` DHTNodes int64 `json:"dht_nodes"` DlInfoData int64 `json:"dl_info_data"` DlInfoSpeed int64 `json:"dl_info_speed"` DlRateLimit int64 `json:"dl_rate_limit"` UpInfoData int64 `json:"up_info_data"` UpInfoSpeed int64 `json:"up_info_speed"` UpRateLimit int64 `json:"up_rate_limit"` }
TransferInfo
https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-global-transfer-info
dl_info_speed integer Global download rate (bytes/s)
dl_info_data integer Data downloaded this session (bytes)
up_info_speed integer Global upload rate (bytes/s)
up_info_data integer Data uploaded this session (bytes)
dl_rate_limit integer Download rate limit (bytes/s)
up_rate_limit integer Upload rate limit (bytes/s)
dht_nodes integer DHT nodes connected to
connection_status string Connection status. See possible values here below