Documentation
¶
Index ¶
- Constants
- type AddTorrentOptions
- type ApiClient
- type Client
- func (c *Client) AddTorrent(ctx context.Context, opt AddTorrentOptions) (*TorrentAdded, error)
- func (c *Client) AddTorrentByData(ctx context.Context, data []byte) (*TorrentAdded, error)
- func (c *Client) AddTorrentByFile(ctx context.Context, filePath string) (*TorrentAdded, error)
- func (c *Client) AddTorrentByURL(ctx context.Context, url string) (*TorrentAdded, error)
- func (c *Client) CloseSession(ctx context.Context) error
- func (c *Client) DeleteTorrent(id int, deleteData bool) (string, error)
- func (c *Client) Execute(ctx context.Context, method string, args any, result any) error
- func (c *Client) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
- func (c *Client) ExecuteCommand(cmd *Command) (*Command, error)
- func (c *Client) FreeSpace(ctx context.Context, path string) (freeBytes int64, totalBytes int64, err error)
- func (c *Client) GetRecentlyActive(ctx context.Context, fields ...string) (active Torrents, removedIDs []int, err error)
- func (c *Client) GetSession(ctx context.Context) (*Session, error)
- func (c *Client) GetStats(ctx ...context.Context) (*Stats, error)
- func (c *Client) GetTorrent(id int, ctx ...context.Context) (*Torrent, error)
- func (c *Client) GetTorrents(ctx ...context.Context) (Torrents, error)
- func (c *Client) GetTorrentsByIDs(ctx context.Context, ids []int, fields ...string) (Torrents, error)
- func (c *Client) PortTest(ctx context.Context) (bool, error)
- func (c *Client) QueueMoveBottom(ctx context.Context, ids ...int) error
- func (c *Client) QueueMoveDown(ctx context.Context, ids ...int) error
- func (c *Client) QueueMoveTop(ctx context.Context, ids ...int) error
- func (c *Client) QueueMoveUp(ctx context.Context, ids ...int) error
- func (c *Client) ReannounceTorrents(ctx context.Context, ids ...int) error
- func (c *Client) RemoveTorrents(ctx context.Context, deleteLocalData bool, ids ...int) error
- func (c *Client) RenameTorrentPath(ctx context.Context, id int, path, newName string) (*RenameResult, error)
- func (c *Client) SetAltSpeedEnabled(ctx context.Context, enabled bool) error
- func (c *Client) SetDownloadDir(ctx context.Context, dir string) error
- func (c *Client) SetSession(ctx context.Context, opt SessionSetOptions) error
- func (c *Client) SetSort(st Sorting)
- func (c *Client) SetSpeedLimit(ctx context.Context, limitType SpeedLimitType, limitKB uint) error
- func (c *Client) SetTorrent(ctx context.Context, ids []int, opt TorrentSetOptions) error
- func (c *Client) SetTorrentLocation(ctx context.Context, location string, move bool, ids ...int) error
- func (c *Client) StartAll(ctx ...context.Context) error
- func (c *Client) StartTorrent(id int) (string, error)
- func (c *Client) StartTorrents(ctx context.Context, ids ...int) error
- func (c *Client) StartTorrentsNow(ctx context.Context, ids ...int) error
- func (c *Client) StopAll(ctx ...context.Context) error
- func (c *Client) StopTorrent(id int) (string, error)
- func (c *Client) StopTorrents(ctx context.Context, ids ...int) error
- func (c *Client) UpdateBlocklist(ctx context.Context) (int, error)
- func (c *Client) VerifyAll(ctx ...context.Context) error
- func (c *Client) VerifyTorrent(id int) (string, error)
- func (c *Client) VerifyTorrents(ctx context.Context, ids ...int) error
- func (c *Client) Version() string
- type Command
- func NewAddCmd() *Command
- func NewAddCmdByFile(file string) (*Command, error)
- func NewAddCmdByFilename(filename string) *Command
- func NewAddCmdByURL(url string) *Command
- func NewGetTorrentsCmd() *Command
- func NewSessionSetCommand() *Command
- func NewSpeedLimitCommand(limitType SpeedLimitType, limit uint) *Command
- type File
- type FileStat
- type Option
- type Peer
- type RenameResult
- type Session
- type SessionSetOptions
- type Sorting
- type SpeedLimitType
- type Stats
- type Torrent
- type TorrentAdded
- type TorrentSetOptions
- type Torrents
- func (t Torrents) GetIDs() []int
- func (t Torrents) SortAge(reverse bool)
- func (t Torrents) SortDownSpeed(reverse bool)
- func (t Torrents) SortDownloaded(reverse bool)
- func (t Torrents) SortID(reverse bool)
- func (t Torrents) SortName(reverse bool)
- func (t Torrents) SortProgress(reverse bool)
- func (t Torrents) SortRatio(reverse bool)
- func (t Torrents) SortSize(reverse bool)
- func (t Torrents) SortUpSpeed(reverse bool)
- func (t Torrents) SortUploaded(reverse bool)
- type Tracker
- type TransmissionClient
Constants ¶
const ( StatusStopped = 0 // Torrent is stopped StatusCheckPending = 1 // Queued to check files StatusChecking = 2 // Checking files StatusDownloadPending = 3 // Queued to download StatusDownloading = 4 // Downloading StatusSeedPending = 5 // Queued to seed StatusSeeding = 6 // Seeding )
Torrent Status constants (matches libtransmission tr_stat status)
const ( PriorityLow = -1 PriorityNormal = 0 PriorityHigh = 1 )
Bandwidth Priority constants
const ( SeedRatioModeGlobal = 0 // Follow global ratio limit SeedRatioModeCustom = 1 // Follow per-torrent ratio limit SeedRatioModeUnlimited = 2 // Unlimited seed ratio )
SeedRatioMode constants
const ( SeedIdleModeGlobal = 0 // Follow global idle seeding limit SeedIdleModeCustom = 1 // Follow per-torrent idle seeding limit SeedIdleModeUnlimited = 2 // Unlimited idle seeding )
SeedIdleMode constants
const ( ErrorNone = 0 // No error ErrorTrackerWarning = 1 // Tracker warning ErrorTrackerError = 2 // Tracker error ErrorLocalError = 3 // Local filesystem or permission error )
Error codes reported by Transmission
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddTorrentOptions ¶
type AddTorrentOptions struct {
Cookies *string `json:"cookies,omitempty"`
DownloadDir *string `json:"download-dir,omitempty"`
Filename *string `json:"filename,omitempty"`
MetaInfo *string `json:"metainfo,omitempty"`
Paused *bool `json:"paused,omitempty"`
PeerLimit *int `json:"peer-limit,omitempty"`
BandwidthPriority *int `json:"bandwidthPriority,omitempty"`
FilesUnwanted []int `json:"files-unwanted,omitempty"`
FilesWanted []int `json:"files-wanted,omitempty"`
PriorityHigh []int `json:"priority-high,omitempty"`
PriorityLow []int `json:"priority-low,omitempty"`
PriorityNormal []int `json:"priority-normal,omitempty"`
Labels []string `json:"labels,omitempty"`
}
AddTorrentOptions defines options for adding a new torrent via torrent-add.
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
ApiClient is a backwards-compatible wrapper.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client interacts with the Transmission RPC API.
func (*Client) AddTorrent ¶
func (c *Client) AddTorrent(ctx context.Context, opt AddTorrentOptions) (*TorrentAdded, error)
AddTorrent adds a torrent using custom AddTorrentOptions.
func (*Client) AddTorrentByData ¶
AddTorrentByData adds a torrent from raw .torrent bytes.
func (*Client) AddTorrentByFile ¶
AddTorrentByFile adds a torrent by reading a local .torrent file.
func (*Client) AddTorrentByURL ¶
AddTorrentByURL adds a torrent from a magnet link or HTTP/HTTPS URL.
func (*Client) CloseSession ¶
CloseSession cleanly shuts down the Transmission daemon.
func (*Client) DeleteTorrent ¶
DeleteTorrent deletes a torrent by ID and returns the torrent name (backwards-compatible).
func (*Client) Execute ¶
Execute performs a JSON-RPC request to the Transmission daemon with automatic CSRF token renewal.
func (*Client) ExecuteAddCommand ¶
func (c *Client) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
ExecuteAddCommand is preserved for backwards compatibility.
func (*Client) ExecuteCommand ¶
ExecuteCommand executes a legacy Command.
func (*Client) FreeSpace ¶
func (c *Client) FreeSpace(ctx context.Context, path string) (freeBytes int64, totalBytes int64, err error)
FreeSpace checks remaining and total storage space for the given filesystem path.
func (*Client) GetRecentlyActive ¶
func (c *Client) GetRecentlyActive(ctx context.Context, fields ...string) (active Torrents, removedIDs []int, err error)
GetRecentlyActive fetches only torrents that were recently active, plus IDs of recently removed torrents.
func (*Client) GetSession ¶
GetSession retrieves the current global session settings.
func (*Client) GetTorrent ¶
GetTorrent returns a single torrent by ID.
func (*Client) GetTorrents ¶
GetTorrents returns all torrents applying the currently configured sort order.
func (*Client) GetTorrentsByIDs ¶
func (c *Client) GetTorrentsByIDs(ctx context.Context, ids []int, fields ...string) (Torrents, error)
GetTorrentsByIDs fetches specified torrents with custom field selection.
func (*Client) PortTest ¶
PortTest checks if Transmission's incoming peer port is open and reachable from the internet.
func (*Client) QueueMoveBottom ¶
QueueMoveBottom moves the specified torrents to the bottom of the queue.
func (*Client) QueueMoveDown ¶
QueueMoveDown moves the specified torrents down by one position in the queue.
func (*Client) QueueMoveTop ¶
QueueMoveTop moves the specified torrents to the top of the queue.
func (*Client) QueueMoveUp ¶
QueueMoveUp moves the specified torrents up by one position in the queue.
func (*Client) ReannounceTorrents ¶
ReannounceTorrents forces an immediate tracker re-announce for the given torrents.
func (*Client) RemoveTorrents ¶
RemoveTorrents deletes one or more torrents and optionally removes downloaded files.
func (*Client) RenameTorrentPath ¶
func (c *Client) RenameTorrentPath(ctx context.Context, id int, path, newName string) (*RenameResult, error)
RenameTorrentPath renames a file or directory within a torrent.
func (*Client) SetAltSpeedEnabled ¶
SetAltSpeedEnabled toggles alternative speed limits ("Turtle Mode").
func (*Client) SetDownloadDir ¶
SetDownloadDir sets the global default download directory.
func (*Client) SetSession ¶
func (c *Client) SetSession(ctx context.Context, opt SessionSetOptions) error
SetSession updates global session settings.
func (*Client) SetSpeedLimit ¶
SetSpeedLimit sets the global upload or download speed limit in KB/s.
func (*Client) SetTorrent ¶
SetTorrent mutates settings for the specified torrents.
func (*Client) SetTorrentLocation ¶
func (c *Client) SetTorrentLocation(ctx context.Context, location string, move bool, ids ...int) error
SetTorrentLocation sets a new location path for torrents and optionally moves data files.
func (*Client) StartTorrent ¶
StartTorrent starts a single torrent by ID (backwards-compatible signature).
func (*Client) StartTorrents ¶
StartTorrents starts one or more torrents by ID.
func (*Client) StartTorrentsNow ¶
StartTorrentsNow starts one or more torrents immediately disregarding queue position.
func (*Client) StopTorrent ¶
StopTorrent stops a single torrent by ID (backwards-compatible signature).
func (*Client) StopTorrents ¶
StopTorrents stops one or more torrents by ID.
func (*Client) UpdateBlocklist ¶
UpdateBlocklist updates the blocklist from the configured blocklist-url and returns the rule count.
func (*Client) VerifyTorrent ¶
VerifyTorrent verifies a single torrent by ID (backwards-compatible signature).
func (*Client) VerifyTorrents ¶
VerifyTorrents verifies file checksums for one or more torrents.
type Command ¶
type Command struct {
Method string `json:"method,omitempty"`
Arguments arguments `json:"arguments,omitempty"`
Result string `json:"result,omitempty"`
}
Command is preserved for backwards compatibility.
func NewAddCmdByFile ¶
NewAddCmdByFile creates a legacy add command by loading a file.
func NewAddCmdByFilename ¶
NewAddCmdByFilename creates a legacy add command with filename.
func NewAddCmdByURL ¶
NewAddCmdByURL creates a legacy add command from URL or magnet.
func NewGetTorrentsCmd ¶
func NewGetTorrentsCmd() *Command
NewGetTorrentsCmd is preserved for backwards compatibility.
func NewSessionSetCommand ¶
func NewSessionSetCommand() *Command
NewSessionSetCommand is preserved for backwards compatibility.
func NewSpeedLimitCommand ¶
func NewSpeedLimitCommand(limitType SpeedLimitType, limit uint) *Command
NewSpeedLimitCommand creates a legacy Command to set speed limits.
func (*Command) SetDownloadDir ¶
SetDownloadDir mutates legacy Command.
type File ¶
type File struct {
BytesCompleted int64 `json:"bytesCompleted"`
Length int64 `json:"length"`
Name string `json:"name"`
}
File represents a file inside a torrent.
type FileStat ¶
type FileStat struct {
BytesCompleted int64 `json:"bytesCompleted"`
Wanted bool `json:"wanted"`
Priority int `json:"priority"`
}
FileStat represents individual file download status.
type Option ¶
type Option func(*Client)
Option configures a Transmission Client.
func WithCustomHeader ¶
WithCustomHeader adds a default HTTP header to all requests.
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client.
func WithTimeout ¶
WithTimeout sets the default request timeout.
type Peer ¶
type Peer struct {
Address string `json:"address"`
ClientName string `json:"clientName"`
ClientIsChoked bool `json:"clientIsChoked"`
ClientIsInterested bool `json:"clientIsInterested"`
FlagStr string `json:"flagStr"`
IsDownloadingFrom bool `json:"isDownloadingFrom"`
IsEncrypted bool `json:"isEncrypted"`
IsIncoming bool `json:"isIncoming"`
IsUploadingTo bool `json:"isUploadingTo"`
PeerIsChoked bool `json:"peerIsChoked"`
PeerIsInterested bool `json:"peerIsInterested"`
Port int `json:"port"`
Progress float64 `json:"progress"`
RateToClient uint64 `json:"rateToClient"`
RateToPeer uint64 `json:"rateToPeer"`
}
Peer represents connected peer information.
type RenameResult ¶
type Session ¶
type Session struct {
AltSpeedDown int64 `json:"alt-speed-down"`
AltSpeedEnabled bool `json:"alt-speed-enabled"`
AltSpeedTimeBegin int `json:"alt-speed-time-begin"`
AltSpeedTimeDay int `json:"alt-speed-time-day"`
AltSpeedTimeEnabled bool `json:"alt-speed-time-enabled"`
AltSpeedTimeEnd int `json:"alt-speed-time-end"`
AltSpeedUp int64 `json:"alt-speed-up"`
BlocklistEnabled bool `json:"blocklist-enabled"`
BlocklistSize int `json:"blocklist-size"`
BlocklistURL string `json:"blocklist-url"`
CacheSizeMB int `json:"cache-size-mb"`
ConfigDir string `json:"config-dir"`
DefaultTrackers string `json:"default-trackers"`
DHTEnabled bool `json:"dht-enabled"`
DownloadDir string `json:"download-dir"`
DownloadDirFreeSpace int64 `json:"download-dir-free-space"`
DownloadQueueEnabled bool `json:"download-queue-enabled"`
DownloadQueueSize int `json:"download-queue-size"`
Encryption string `json:"encryption"`
IdleSeedingLimit int `json:"idle-seeding-limit"`
IdleSeedingLimitEnabled bool `json:"idle-seeding-limit-enabled"`
IncompleteDir string `json:"incomplete-dir"`
IncompleteDirEnabled bool `json:"incomplete-dir-enabled"`
LPDEnabled bool `json:"lpd-enabled"`
PeerLimitGlobal int `json:"peer-limit-global"`
PeerLimitPerTorrent int `json:"peer-limit-per-torrent"`
PeerPort int `json:"peer-port"`
PeerPortRandomOnStart bool `json:"peer-port-random-on-start"`
PexEnabled bool `json:"pex-enabled"`
PortForwardingEnabled bool `json:"port-forwarding-enabled"`
QueueStalledEnabled bool `json:"queue-stalled-enabled"`
QueueStalledMinutes int `json:"queue-stalled-minutes"`
RenamePartialFiles bool `json:"rename-partial-files"`
RPCVersion int `json:"rpc-version"`
RPCVersionMinimum int `json:"rpc-version-minimum"`
RPCVersionSemver string `json:"rpc-version-semver"`
ScriptTorrentAddedEnabled bool `json:"script-torrent-added-enabled"`
ScriptTorrentAddedFilename string `json:"script-torrent-added-filename"`
ScriptTorrentDoneEnabled bool `json:"script-torrent-done-enabled"`
ScriptTorrentDoneFilename string `json:"script-torrent-done-filename"`
SeedQueueEnabled bool `json:"seed-queue-enabled"`
SeedQueueSize int `json:"seed-queue-size"`
SeedRatioLimit float64 `json:"seedRatioLimit"`
SeedRatioLimited bool `json:"seedRatioLimited"`
SessionID string `json:"session-id"`
SpeedLimitDown int64 `json:"speed-limit-down"`
SpeedLimitDownEnabled bool `json:"speed-limit-down-enabled"`
SpeedLimitUp int64 `json:"speed-limit-up"`
SpeedLimitUpEnabled bool `json:"speed-limit-up-enabled"`
StartAddedTorrents bool `json:"start-added-torrents"`
TrashOriginalTorrentFiles bool `json:"trash-original-torrent-files"`
UTPEnabled bool `json:"utp-enabled"`
Version string `json:"version"`
}
Session represents global Transmission session settings.
type SessionSetOptions ¶
type SessionSetOptions struct {
AltSpeedDown *int64 `json:"alt-speed-down,omitempty"`
AltSpeedEnabled *bool `json:"alt-speed-enabled,omitempty"`
AltSpeedTimeBegin *int `json:"alt-speed-time-begin,omitempty"`
AltSpeedTimeDay *int `json:"alt-speed-time-day,omitempty"`
AltSpeedTimeEnabled *bool `json:"alt-speed-time-enabled,omitempty"`
AltSpeedTimeEnd *int `json:"alt-speed-time-end,omitempty"`
AltSpeedUp *int64 `json:"alt-speed-up,omitempty"`
BlocklistEnabled *bool `json:"blocklist-enabled,omitempty"`
BlocklistURL *string `json:"blocklist-url,omitempty"`
CacheSizeMB *int `json:"cache-size-mb,omitempty"`
DefaultTrackers *string `json:"default-trackers,omitempty"`
DHTEnabled *bool `json:"dht-enabled,omitempty"`
DownloadDir *string `json:"download-dir,omitempty"`
DownloadQueueEnabled *bool `json:"download-queue-enabled,omitempty"`
DownloadQueueSize *int `json:"download-queue-size,omitempty"`
Encryption *string `json:"encryption,omitempty"`
IdleSeedingLimit *int `json:"idle-seeding-limit,omitempty"`
IdleSeedingLimitEnabled *bool `json:"idle-seeding-limit-enabled,omitempty"`
IncompleteDir *string `json:"incomplete-dir,omitempty"`
IncompleteDirEnabled *bool `json:"incomplete-dir-enabled,omitempty"`
LPDEnabled *bool `json:"lpd-enabled,omitempty"`
PeerLimitGlobal *int `json:"peer-limit-global,omitempty"`
PeerLimitPerTorrent *int `json:"peer-limit-per-torrent,omitempty"`
PeerPort *int `json:"peer-port,omitempty"`
PeerPortRandomOnStart *bool `json:"peer-port-random-on-start,omitempty"`
PexEnabled *bool `json:"pex-enabled,omitempty"`
PortForwardingEnabled *bool `json:"port-forwarding-enabled,omitempty"`
QueueStalledEnabled *bool `json:"queue-stalled-enabled,omitempty"`
QueueStalledMinutes *int `json:"queue-stalled-minutes,omitempty"`
RenamePartialFiles *bool `json:"rename-partial-files,omitempty"`
ScriptTorrentAddedEnabled *bool `json:"script-torrent-added-enabled,omitempty"`
ScriptTorrentAddedFilename *string `json:"script-torrent-added-filename,omitempty"`
ScriptTorrentDoneEnabled *bool `json:"script-torrent-done-enabled,omitempty"`
ScriptTorrentDoneFilename *string `json:"script-torrent-done-filename,omitempty"`
SeedQueueEnabled *bool `json:"seed-queue-enabled,omitempty"`
SeedQueueSize *int `json:"seed-queue-size,omitempty"`
SeedRatioLimit *float64 `json:"seedRatioLimit,omitempty"`
SeedRatioLimited *bool `json:"seedRatioLimited,omitempty"`
SpeedLimitDown *int64 `json:"speed-limit-down,omitempty"`
SpeedLimitDownEnabled *bool `json:"speed-limit-down-enabled,omitempty"`
SpeedLimitUp *int64 `json:"speed-limit-up,omitempty"`
SpeedLimitUpEnabled *bool `json:"speed-limit-up-enabled,omitempty"`
StartAddedTorrents *bool `json:"start-added-torrents,omitempty"`
TrashOriginalTorrentFiles *bool `json:"trash-original-torrent-files,omitempty"`
UTPEnabled *bool `json:"utp-enabled,omitempty"`
}
SessionSetOptions defines options for mutating global session settings.
type SpeedLimitType ¶
type SpeedLimitType string
SpeedLimitType defines whether a limit applies to download or upload
const ( DownloadLimitType SpeedLimitType = "downloadlimit" UploadLimitType SpeedLimitType = "uploadlimit" )
type Stats ¶
type Stats struct {
ActiveTorrentCount int `json:"activeTorrentCount"`
CumulativeStats cumulativeStats `json:"cumulative-stats"`
CurrentStats currentStats `json:"current-stats"`
DownloadSpeed uint64 `json:"downloadSpeed"`
PausedTorrentCount int `json:"pausedTorrentCount"`
TorrentCount int `json:"torrentCount"`
UploadSpeed uint64 `json:"uploadSpeed"`
}
Stats holds Transmission cumulative and session stats.
func (*Stats) CumulativeActiveTime ¶
func (*Stats) CurrentActiveTime ¶
type Torrent ¶
type Torrent struct {
ActivityDate int64 `json:"activityDate"`
AddedDate int64 `json:"addedDate"`
BandwidthPriority int `json:"bandwidthPriority"`
Comment string `json:"comment"`
CorruptEver uint64 `json:"corruptEver"`
Creator string `json:"creator"`
DateCreated int64 `json:"dateCreated"`
DesiredAvailable uint64 `json:"desiredAvailable"`
DoneDate int64 `json:"doneDate"`
DownloadDir string `json:"downloadDir"`
DownloadedEver uint64 `json:"downloadedEver"`
DownloadLimit int `json:"downloadLimit"`
DownloadLimited bool `json:"downloadLimited"`
EditDate int64 `json:"editDate"`
Error int `json:"error"`
ErrorString string `json:"errorString"`
Eta time.Duration `json:"eta"`
EtaIdle time.Duration `json:"etaIdle"`
FileCount int `json:"fileCount"`
Files []File `json:"files"`
FileStats []FileStat `json:"fileStats"`
HashString string `json:"hashString"`
HaveUnchecked uint64 `json:"haveUnchecked"`
HaveValid uint64 `json:"haveValid"`
HonorsSessionLimits bool `json:"honorsSessionLimits"`
ID int `json:"id"`
IsFinished bool `json:"isFinished"`
IsPrivate bool `json:"isPrivate"`
IsStalled bool `json:"isStalled"`
Labels []string `json:"labels"`
LeftUntilDone uint64 `json:"leftUntilDone"`
ManualAnnounceTime int64 `json:"manualAnnounceTime"`
MaxConnectedPeers int `json:"maxConnectedPeers"`
MetadataPercentComplete float64 `json:"metadataPercentComplete"`
Name string `json:"name"`
PeerLimit int `json:"peer-limit"`
Peers []Peer `json:"peers"`
PeersConnected int `json:"peersConnected"`
PeersFrom map[string]int `json:"peersFrom"`
PeersGettingFromUs int `json:"peersGettingFromUs"`
PeersSendingToUs int `json:"peersSendingToUs"`
PercentComplete float64 `json:"percentComplete"`
PercentDone float64 `json:"percentDone"`
PieceCount int `json:"pieceCount"`
PieceSize int64 `json:"pieceSize"`
Priorities []int `json:"priorities"`
QueuePosition int `json:"queuePosition"`
RateDownload uint64 `json:"rateDownload"`
RateUpload uint64 `json:"rateUpload"`
RecheckProgress float64 `json:"recheckProgress"`
SecondsDownloading int `json:"secondsDownloading"`
SecondsSeeding int `json:"secondsSeeding"`
SeedIdleLimit int `json:"seedIdleLimit"`
SeedIdleMode int `json:"seedIdleMode"`
SeedRatioLimit float64 `json:"seedRatioLimit"`
SeedRatioMode int `json:"seedRatioMode"`
SizeWhenDone uint64 `json:"sizeWhenDone"`
StartDate int64 `json:"startDate"`
Status int `json:"status"`
Trackers []Tracker `json:"trackers"`
TotalSize uint64 `json:"totalSize"`
TorrentFile string `json:"torrentFile"`
UploadedEver uint64 `json:"uploadedEver"`
UploadLimit int `json:"uploadLimit"`
UploadLimited bool `json:"uploadLimited"`
UploadRatio float64 `json:"uploadRatio"`
Wanted []int `json:"wanted"`
Webseeds []string `json:"webseeds"`
WebseedsSendingToUs int `json:"webseedsSendingToUs"`
}
Torrent represents all attributes of a Transmission torrent.
func (*Torrent) GetTrackers ¶
GetTrackers returns announce URLs separated by newlines.
func (*Torrent) TorrentStatus ¶
TorrentStatus returns human-readable status name.
type TorrentAdded ¶
type TorrentAdded struct {
HashString string `json:"hashString"`
ID int `json:"id"`
Name string `json:"name"`
}
TorrentAdded represents the response from adding a torrent.
type TorrentSetOptions ¶
type TorrentSetOptions struct {
BandwidthPriority *int `json:"bandwidthPriority,omitempty"`
DownloadLimit *int `json:"downloadLimit,omitempty"`
DownloadLimited *bool `json:"downloadLimited,omitempty"`
FilesUnwanted []int `json:"files-unwanted,omitempty"`
FilesWanted []int `json:"files-wanted,omitempty"`
Group *string `json:"group,omitempty"`
HonorsSessionLimits *bool `json:"honorsSessionLimits,omitempty"`
Labels []string `json:"labels,omitempty"`
Location *string `json:"location,omitempty"`
PeerLimit *int `json:"peer-limit,omitempty"`
PriorityHigh []int `json:"priority-high,omitempty"`
PriorityLow []int `json:"priority-low,omitempty"`
PriorityNormal []int `json:"priority-normal,omitempty"`
QueuePosition *int `json:"queuePosition,omitempty"`
SeedIdleLimit *int `json:"seedIdleLimit,omitempty"`
SeedIdleMode *int `json:"seedIdleMode,omitempty"`
SeedRatioLimit *float64 `json:"seedRatioLimit,omitempty"`
SeedRatioMode *int `json:"seedRatioMode,omitempty"`
SequentialDownload *bool `json:"sequentialDownload,omitempty"`
SequentialDownloadFromPiece *int `json:"sequentialDownloadFromPiece,omitempty"`
TrackerList *string `json:"trackerList,omitempty"`
UploadLimit *int `json:"uploadLimit,omitempty"`
UploadLimited *bool `json:"uploadLimited,omitempty"`
}
TorrentSetOptions specifies parameters for mutating torrents via torrent-set.
type Torrents ¶
type Torrents []*Torrent
Torrents represents a slice of *Torrent with utility methods.
func (Torrents) SortDownSpeed ¶
SortDownSpeed sorts torrents by download speed.
func (Torrents) SortDownloaded ¶
SortDownloaded sorts torrents by total downloaded bytes ever.
func (Torrents) SortProgress ¶
SortProgress sorts torrents by percent done.
func (Torrents) SortUpSpeed ¶
SortUpSpeed sorts torrents by upload speed.
func (Torrents) SortUploaded ¶
SortUploaded sorts torrents by total uploaded bytes ever.
type Tracker ¶
type Tracker struct {
Announce string `json:"announce"`
ID int `json:"id"`
Scrape string `json:"scrape"`
Tier int `json:"tier"`
}
tracker represents tracker information for a torrent.
type TransmissionClient ¶
type TransmissionClient = Client
TransmissionClient is an alias for Client for backwards compatibility.