Documentation ¶
Index ¶
- type ApiClient
- type Command
- type Priority
- type Sorting
- type Stats
- type Status
- type Torrent
- type TorrentAdded
- 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 TransmissionClient
- func (ac *TransmissionClient) Add(fn string, dndir string) (TorrentAdded, error)
- func (ac *TransmissionClient) DeleteTorrent(id int, 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(id int) (*Torrent, error)
- func (ac *TransmissionClient) GetTorrents() (Torrents, error)
- func (ac *TransmissionClient) Rename(id int, sn, dn string) (resp Command, err error)
- func (ac *TransmissionClient) SetSort(st Sorting)
- func (ac *TransmissionClient) StartAll() error
- func (ac *TransmissionClient) StartTorrent(id int) (string, error)
- func (ac *TransmissionClient) StopAll() error
- func (ac *TransmissionClient) StopTorrent(id int) (string, error)
- func (ac *TransmissionClient) VerifyAll() error
- func (ac *TransmissionClient) VerifyTorrent(id int) (string, error)
- func (ac *TransmissionClient) Version() string
Constants ¶
This section is empty.
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 (*Command) SetDownloadDir ¶
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 Status `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"` 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"` Files []file `json:"files"` FileStats []fileStat `json:"fileStats"` TrackerStats []trackerStat `json:"trackerStats"` Peers []peer `json:"peers"` Hash string `json:"hashString"` }
Torrent struct for torrents
func (*Torrent) GetTrackers ¶
GetTrackers combines the torrent's trackers in one string
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) Add ¶
func (ac *TransmissionClient) Add(fn string, dndir string) (TorrentAdded, error)
func (*TransmissionClient) DeleteTorrent ¶
func (ac *TransmissionClient) DeleteTorrent(id int, 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(id int) (*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) Rename ¶
func (ac *TransmissionClient) Rename(id int, sn, dn string) (resp Command, err error)
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(id int) (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(id int) (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(id int) (string, error)
VerifyTorrent verifies a torrent
func (*TransmissionClient) Version ¶
func (ac *TransmissionClient) Version() string
Version returns transmission's version