Documentation
¶
Index ¶
- Constants
- type ApiClient
- 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 Sorting
- type SpeedLimitType
- type Stats
- type Torrent
- type TorrentAdded
- type Torrents
- func (t Torrents) GetHashes() []string
- 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 TransmissionClient
- func (ac *TransmissionClient) DeleteTorrent(identifier any, wd bool) (string, error)
- func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
- func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
- func (ac *TransmissionClient) GetStats() (*Stats, error)
- func (ac *TransmissionClient) GetTorrent(identifier any) (*Torrent, error)
- func (ac *TransmissionClient) GetTorrents() (Torrents, error)
- func (ac *TransmissionClient) SetSort(st Sorting)
- func (ac *TransmissionClient) StartAll() error
- func (ac *TransmissionClient) StartTorrent(identifier any) (string, error)
- func (ac *TransmissionClient) StopAll() error
- func (ac *TransmissionClient) StopTorrent(identifier any) (string, error)
- func (ac *TransmissionClient) VerifyAll() error
- func (ac *TransmissionClient) VerifyTorrent(identifier any) (string, error)
- func (ac *TransmissionClient) Version() string
Constants ¶
const ( StatusStopped = iota StatusCheckPending StatusChecking StatusDownloadPending StatusDownloading StatusSeedPending StatusSeeding )
const ( DownloadLimitType = "downloadlimit" UploadLimitType = "uploadlimit" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func (*ApiClient) CreateClient ¶
type Command ¶
type Command struct {
Method string `json:"method,omitempty"`
Arguments arguments `json:"arguments,omitempty"`
Result string `json:"result,omitempty"`
}
func NewAddCmdByFile ¶
func NewAddCmdByFilename ¶
func NewGetTorrentsCmd ¶
func NewGetTorrentsCmd() *Command
func NewSessionSetCommand ¶
func NewSessionSetCommand() *Command
func NewSpeedLimitCommand ¶
func NewSpeedLimitCommand(limitType SpeedLimitType, limit uint) *Command
newSpeedLimitCommand creates a new command that mutates either a download or upload limit.
func (*Command) SetDownloadDir ¶
type SpeedLimitType ¶
type SpeedLimitType string
type Stats ¶
type Stats struct {
ActiveTorrentCount int
CumulativeStats cumulativeStats
CurrentStats currentStats
DownloadSpeed uint64
PausedTorrentCount int
TorrentCount int
UploadSpeed uint64
}
session-stats
func (*Stats) CumulativeActiveTime ¶
func (*Stats) CurrentActiveTime ¶
type Torrent ¶
type Torrent struct {
ID int `json:"id"`
Name string `json:"name"`
Status int `json:"status"`
AddedDate int64 `json:"addedDate"`
LeftUntilDone uint64 `json:"leftUntilDone"`
SizeWhenDone uint64 `json:"sizeWhenDone"`
Eta time.Duration `json:"eta"`
UploadRatio float64 `json:"uploadRatio"`
RateDownload uint64 `json:"rateDownload"`
RateUpload uint64 `json:"rateUpload"`
DownloadDir string `json:"downloadDir"`
DownloadedEver uint64 `json:"downloadedEver"`
UploadedEver uint64 `json:"uploadedEver"`
HashString string `json:"hashString"`
HaveUnchecked uint64 `json:"haveUnchecked"`
HaveValid uint64 `json:"haveValid"`
IsFinished bool `json:"isFinished"`
PercentDone float64 `json:"percentDone"`
SeedRatioMode int `json:"seedRatioMode"`
Trackers []tracker `json:"trackers"`
Error int `json:"error"`
ErrorString string `json:"errorString"`
}
Torrent struct for torrents
func (*Torrent) GetTrackers ¶
GetTrackers combines the torrent's trackers in one string
func (*Torrent) TorrentStatus ¶
Status translates the status of the torrent
type TorrentAdded ¶
type TorrentAdded struct {
HashString string `json:"hashString"`
ID int `json:"id"`
Name string `json:"name"`
}
TorrentAdded data returning
type Torrents ¶
type Torrents []*Torrent
Torrents represent []Torrent
func (Torrents) SortDownSpeed ¶
func (Torrents) SortDownloaded ¶
func (Torrents) SortProgress ¶
func (Torrents) SortUpSpeed ¶
func (Torrents) SortUploaded ¶
type TransmissionClient ¶
type TransmissionClient struct {
// contains filtered or unexported fields
}
TransmissionClient to talk to transmission
func New ¶
func New(url string, username string, password string) (*TransmissionClient, error)
New create new transmission torrent
func (*TransmissionClient) DeleteTorrent ¶
func (ac *TransmissionClient) DeleteTorrent(identifier any, wd bool) (string, error)
Delete takes a bool, if true it will delete with data; returns the name of the deleted torrent if it succeed
func (*TransmissionClient) ExecuteAddCommand ¶
func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
func (*TransmissionClient) ExecuteCommand ¶
func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
func (*TransmissionClient) GetStats ¶
func (ac *TransmissionClient) GetStats() (*Stats, error)
GetStats returns "session-stats"
func (*TransmissionClient) GetTorrent ¶
func (ac *TransmissionClient) GetTorrent(identifier any) (*Torrent, error)
GetTorrent takes an id and returns *Torrent
func (*TransmissionClient) GetTorrents ¶
func (ac *TransmissionClient) GetTorrents() (Torrents, error)
GetTorrents get a list of torrents
func (*TransmissionClient) SetSort ¶
func (ac *TransmissionClient) SetSort(st Sorting)
SetSort takes a 'Sorting' to set 'sortType'
func (*TransmissionClient) StartAll ¶
func (ac *TransmissionClient) StartAll() error
StartAll starts all the torrents
func (*TransmissionClient) StartTorrent ¶
func (ac *TransmissionClient) StartTorrent(identifier any) (string, error)
StartTorrent start the torrent
func (*TransmissionClient) StopAll ¶
func (ac *TransmissionClient) StopAll() error
StopAll stops all torrents
func (*TransmissionClient) StopTorrent ¶
func (ac *TransmissionClient) StopTorrent(identifier any) (string, error)
StopTorrent start the torrent
func (*TransmissionClient) VerifyAll ¶
func (ac *TransmissionClient) VerifyAll() error
VerifyAll verfies all torrents
func (*TransmissionClient) VerifyTorrent ¶
func (ac *TransmissionClient) VerifyTorrent(identifier any) (string, error)
VerifyTorrent verifies a torrent
func (*TransmissionClient) Version ¶
func (ac *TransmissionClient) Version() string
Version returns transmission's version