Documentation
¶
Index ¶
- Constants
- type ApiClient
- type Command
- func NewAddCmd() (*Command, error)
- func NewAddCmdByFile(file string) (*Command, error)
- func NewAddCmdByFilename(filename string) (*Command, error)
- func NewAddCmdByMagnet(magnetLink string) (*Command, error)
- func NewAddCmdByURL(url string) (*Command, error)
- func NewDelCmd(id int, removeFile bool) (*Command, error)
- func NewGetTorrentsCmd() (*Command, error)
- type Torrent
- type TorrentAdded
- type Torrents
- type TransmissionClient
- func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
- func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
- func (ac *TransmissionClient) GetTorrents() (Torrents, error)
- func (ac *TransmissionClient) StartTorrent(id int) (string, error)
- func (ac *TransmissionClient) StopTorrent(id int) (string, error)
Constants ¶
View Source
const ( StatusPaused = 0 StatusWait = 1 StatusCheck = 2 StatusDownloadWait = 3 StatusDownload = 4 StatisSeedWait = 5 StatusSeed = 6 )
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 NewAddCmdByMagnet ¶
func NewAddCmdByURL ¶
func NewGetTorrentsCmd ¶
func (*Command) SetDownloadDir ¶
type Torrent ¶
type Torrent struct {
ID int `json:"id"`
Name string `json:"name"`
Status int `json:"status"`
AddedDate int `json:"addedDate"`
LeftUntilDone int `json:"leftUntilDone"`
Eta int `json:"eta"`
UploadRatio float64 `json:"uploadRatio"`
RateDownload int `json:"rateDownload"`
RateUpload int `json:"rateUpload"`
DownloadDir string `json:"downloadDir"`
IsFinished bool `json:"isFinished"`
PercentDone float64 `json:"percentDone"`
SeedRatioMode int `json:"seedRatioMode"`
HashString string `json:"hashString"`
Error int `json:"error"`
ErrorString string `json:"errorString"`
}
Torrent struct for torrents
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) SortByAddedDate ¶
func (Torrents) SortByName ¶
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
New create new transmission torrent
func (*TransmissionClient) ExecuteAddCommand ¶
func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
func (*TransmissionClient) ExecuteCommand ¶
func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
func (*TransmissionClient) GetTorrents ¶
func (ac *TransmissionClient) GetTorrents() (Torrents, error)
GetTorrents get a list of torrents
func (*TransmissionClient) StartTorrent ¶
func (ac *TransmissionClient) StartTorrent(id int) (string, error)
StartTorrent start the torrent
func (*TransmissionClient) StopTorrent ¶
func (ac *TransmissionClient) StopTorrent(id int) (string, error)
StopTorrent start the torrent
Click to show internal directories.
Click to hide internal directories.